-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[CLANG-CL] ignores Wpadded #134426
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
[CLANG-CL] ignores Wpadded #134426
Conversation
…der.cpp" This reverts commit 3a9bc90.
Fixes the issue in #130182 where the variable @mikaelholmen @asb, could you please confirm if this resolves the issue on your end? |
return; | ||
} | ||
unsigned CharBitNum = Context.getTargetInfo().getCharWidth(); | ||
uint64_t DataSizeInBits = Context.toBits(DataSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand all the implications of using DataSize... yes, it handles empty structs, but there's also the interaction with RequiredAlignment, which I'm not sure behaves the way you want for non-empty structs. (I think you can test this using an "aligned" attribute on a struct.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were right, using DataSize did create issues while using certain alignment attributes. I added some in the test file.
Now, 1 byte is artificially added to UnpaddedSizeInBits
when Size
is zero before aligning the empty struct to its alignment. This allows to keep the checks as they used to be (using Size instead of DataSize) and also takes care of the empty struct case.
Thank you for catching that case!
…tructs with required alignments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
After this change, it seems that (Reproduction: I compiled the sample program in #61702 using all three executables, with and without -Wall; only |
For -Wall, see #102982 |
Got it, thanks. |
[clang] add support for -Wpadded on Windows Implements the -Wpadded warning for --target=x86_64-windows-msvc etc. Fixes llvm#61702 .
Implements the Wpadded diagnostic for clang-cl.
#61702