-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc]: Remove -Wglobal-constructors
for libc tests
#131485
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
[libc]: Remove -Wglobal-constructors
for libc tests
#131485
Conversation
-Wglobal-constructors
-Wglobal-constructors
for libc tests
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
With regards to: #119281 Do you have any suggestions on how to fix the code for this warning? AFAICT, by marking the test class instances as For what it's worth, the registration mechanism is identical to how Google Test does it , so one way could just be removing this warning for these warnings via pragma/NOLINTBEGIN|NOLINTEND |
Another possibility is to make the test constructors |
As of 0ab2965 : while trying to constexpr things (and remove virtual destructor to make Test a literal type which can be fails with:
I think wrapping with pragma may be the only way here short of disabling the warning for the whole test suite. Update: even disabling the wglobal-constructor warning is proving difficult as of e8be053, because of how macro definitions are expanded |
FWIW: the reason 6b558fb didn't work is: https://stackoverflow.com/a/5804024
One way to ODR-use it is put that I managed to figure out how to use UPdate: Additionally, making the assumption that all the compilers that are used to build libc, support |
As of 53bacd0, there are no |
0fcd719
to
53bacd0
Compare
This PR is ready for review now |
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 don't think there's any utility in enabling this for the tests. The reason we pass -Werror=global-constructors
is because libc
itself should never use global objects. The tests, however, want to test the things that implement global constructors (like the integration tests). Also, sometimes a global constructor is the easiest way to initialize something for a test. There's no harm here because it's just a test that's not being shipped and any functional crt1.o
should handle it.
Understood, in that case, shall I just remove the commented out line from the |
16e268d
to
1fc892b
Compare
-Wglobal-constructors
for libc tests-Wglobal-constructors
for libc tests
CI failures seem to be unrelated to this change:
|
@jhuber6 You might have to merge this one as I don't have merge permissions. Thanks! (assuming CI failure is unrelated (almost certainly)) |
…1485) * Relates to: llvm/llvm-project#119281 * Removes `-Wglobal-constructors` as per: llvm/llvm-project#131485 (review)
* Relates to: llvm#119281 * Removes `-Wglobal-constructors` as per: llvm#131485 (review)
-Wglobal-constructors
as per: [libc]: Remove-Wglobal-constructors
for libc tests #131485 (review)