[libcxx-commits] [PATCH] D118874: [libc++][nfc] Use TEST_SAFE_STATIC.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 3 09:57:10 PST 2022


Quuxplusone added a comment.

FWIW, I think this PR is fine as-is, but there //also// seems to be room for a much larger improvement to how we do (and name) `_LIBCPP_SAFE_STATIC` at all. Meanwhile, the point of these tests is actually to //verify// that the relevant ctors are `constexpr`, so having them use any macro that sometimes expands to "nothing" smells like it's losing us test coverage. If I were doing the followup patch (which maybe I am? let me know :)), I'd:

- Rename `_LIBCPP_SAFE_STATIC` to `_LIBCPP_CONSTINIT`

-Make `_LIBCPP_CONSTINIT` expand to `constinit` in C++20 mode, else `__attribute__((__require_constant_initialization__))` if supported, else seriously consider making it a hard error (where right now it expands to nothing).

- Rename `TEST_SAFE_STATIC` to `TEST_CONSTINIT`, and make it ​expand to `_LIBCPP_CONSTINIT` if it's defined, else if C++20 then `constinit`, else nothing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118874/new/

https://reviews.llvm.org/D118874



More information about the libcxx-commits mailing list