<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [ms] Poor diagnostic when having __declspec and __attribute__ in the wrong order"
   href="https://llvm.org/bugs/show_bug.cgi?id=24925">24925</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ms] Poor diagnostic when having __declspec and __attribute__ in the wrong order
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat test2.cc
class __declspec(dllexport)
    __attribute__((annotate("blink_gc_plugin_ignore"))) Foo {};


$ bin/clang-cl -c test2.cc
test2.cc(1,1) :  error: declaration of anonymous class must be a definition
class __declspec(dllexport)
^
test2.cc(1,1) :  warning: declaration does not declare anything
[-Wmissing-declarations]
class __declspec(dllexport)
^
1 warning and 1 error generated.


In real life, this causes several cascading errors [1]. We should detect this
and say "__declspec must come before __attribute__" or something like that. (Or
we could allow interleaving declspecs and attributes – these are usually hidden
behind macros, and having to know which macros happen to be declspecs and which
are attributes is a bit annoying. On the other hand, it's nice that this
enforces a consistent ordering. On the third hand, this consistent ordering
isn't enforced if you have two attribute-based macros or two declspec-based
ones)


1: The diagnostic we got on our bots:
FAILED: ninja -t msvc -e environment.x86 --
"..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl" -m32 /nologo
/showIncludes /FC
@obj\third_party\WebKit\Source\core\animation\webcore_shared.DeferredLegacyStyleInterpolation.obj.rsp
/c
..\..\third_party\WebKit\Source\core\animation\DeferredLegacyStyleInterpolation.cpp
/Foobj\third_party\WebKit\Source\core\animation\webcore_shared.DeferredLegacyStyleInterpolation.obj
/Fdobj\third_party\WebKit\Source\core\webcore_shared.cc.pdb 
In file included from
..\..\third_party\WebKit\Source\core\animation\DeferredLegacyStyleInterpolation.cpp:10:
..\..\third_party\WebKit\Source\core/css/CSSBasicShapeValue.h(46,1) : error:
declaration of anonymous class must be a definition
class CORE_EXPORT GC_PLUGIN_IGNORE("535448") CSSBasicShapeValue : public
CSSValue {
^
..\..\third_party\WebKit\Source\core/css/CSSBasicShapeValue.h(46,1) : error:
declaration does not declare anything [-Werror,-Wmissing-declarations]
class CORE_EXPORT GC_PLUGIN_IGNORE("535448") CSSBasicShapeValue : public
CSSValue {
^
..\..\third_party\WebKit\Source\core/css/CSSBasicShapeValue.h(78,47) : error:
base class has incomplete type
class CSSBasicShapeCircleValue final : public CSSBasicShapeValue {
                                       ~~~~~~~^~~~~~~~~~~~~~~~~~
..\..\third_party\WebKit\Source\core/animation/DeferredLegacyStyleInterpolation.h(15,7)
:  note: forward declaration of 'blink::CSSBasicShapeValue'
class CSSBasicShapeValue;
      ^</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>