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

Vinay Deshmukh via libc-commits libc-commits at lists.llvm.org
Wed Apr 9 18:18:56 PDT 2025


vinay-deshmukh wrote:

> 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 `.cmake` to resolve this part of the issue ?

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


More information about the libc-commits mailing list