-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[clang] Accept empty enum in MSVC compatible C #159981
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
Changes from 7 commits
77fc06c
191eacf
e153bf2
c106aaa
6bb40da
d9ab0fe
f573438
b1cbba5
4dfd0fd
259e58d
394ae9c
5db9747
475b498
a1232cd
e515d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions | ||
|
|
||
| typedef enum tag1 { } A; // expected-warning {{empty enumeration types are a Microsoft extension}} | ||
| typedef enum tag2 { } B; // expected-warning {{empty enumeration types are a Microsoft extension}} | ||
| typedef enum : unsigned { } C; // expected-warning {{enumeration types with a fixed underlying type are a Microsoft extension}}\ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't warn 2x, the 'with a fixed underlying type' version is sufficient. Also, isn't this a C23 extension, not a microsoft extension (or at least, as well)? See:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review!
In microsoft-extension mode, it's
Should we suppress the 2nd
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little confused here as to the order of warnings/what we should do. I suspect @AaronBallman and I need to spend some time figuring out/discussing what we're looking for. I'm not sure about the suppressing the 2nd warning, there is perhaps a 'we should do both' kinda thing since one might be disabled, but it also looks silly. Ping this in another ~week and a half, and Aaron and I can discuss it (he should be back by then!).
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think emitting two diagnostics is fine (one for the underlying type and one for the empty enum) because they are separate extensions. But I think it's a bit odd that we claim the underlying type is a Microsoft extension rather than a C23 extension -- that seems to be a preexisting issue which could be handled in a separate PR: https://godbolt.org/z/sMhGoE3qq |
||
| // expected-warning {{empty enumeration types are a Microsoft extension}} | ||
Uh oh!
There was an error while loading. Please reload this page.