[libc-commits] [libc] [libc]: Add `-Wglobal-constructors` for libc tests (PR #131485)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 22 20:49:10 PDT 2025


lntue wrote:

> @nickdesaulniers @lntue
> 
> 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 `static`, the warning goes away, but doing so prevents any tests from being run (as the PR checks are failing right now) which I'm not sure why it happens yet.
> 
> 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 seems to be making the test constructors `constexpr` instead of `static`, but I'm not sure how invasive that change would be.

https://github.com/llvm/llvm-project/pull/131485


More information about the libc-commits mailing list