Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ms] Poor diagnostic when having __declspec and __attribute__ in the wrong order #25299

Closed
nico opened this issue Sep 24, 2015 · 1 comment
Closed
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate

Comments

@nico
Copy link
Contributor

nico commented Sep 24, 2015

Bugzilla Link 24925
Resolution DUPLICATE
Resolved on Sep 24, 2015 09:41
Version trunk
OS All
CC @AaronBallman,@zmodem

Extended Description

$ 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;
^

@AaronBallman
Copy link
Collaborator

*** This bug has been marked as a duplicate of bug #24933 ***

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

2 participants