[libcxx-commits] [PATCH] D117993: [libc++][RFC] Guard against libc++ macros in tests.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 23 09:50:15 PST 2022


Quuxplusone added a comment.

Interesting. Is there some way to generalize this to catch all but a whitelist of `_LIBCPP` macros? Here's the current tally; can we think of any way to eliminate more of these?

  $ git grep -h '#if.*[ (]_LIBCPP' ../libcxx/test/std/ | sort | uniq -c | sort -rn
   110 #ifndef _LIBCPP_HAS_NO_INT128
    86 #if defined(_LIBCPP_VERSION)
    84 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
    26 #ifndef _LIBCPP_HAS_NO_CHAR8_T
    14 #ifdef _LIBCPP_VERSION
     9 #ifndef _LIBCPP_HAS_NO_THREADS
     6 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
     4 //#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
     4 #ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
     4 #ifndef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
     4 #if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION)
     3 #if defined(_LIBCPP_VERSION) && 0 // FIXME these extensions are currently disabled.
     3 #if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
     2 #ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
     2 #ifndef _LIBCPP_ABI_MICROSOFT
     2 #ifdef _LIBCPP_VERSION // extension
     2 #ifdef _LIBCPP_VERSION // Don't violate precondition [atomics.flag]/6
     2 #if defined(_LIBCPP_VERSION) && TEST_STD_VER >= 11
     2 #if TEST_STD_VER == 11 && defined(_LIBCPP_VERSION)
     2 #if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
     1 #ifndef _LIBCPP_UTILITY
     1 #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION
     1 #ifndef _LIBCPP_DEBUG
     1 #ifdef _LIBCPP_VERSION // assignment from std::array is a libc++ extension
     1 #ifdef _LIBCPP_SAFE_STATIC
     1 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
     1 #ifdef _LIBCPP_HAS_NO_NULLPTR
     1 #ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO  // https://llvm.org/PR35967
     1 #if defined(_LIBCPP_VERSION) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
     1 #if defined(_LIBCPP_USING_ARC4_RANDOM)
     1 #if __has_attribute(vector_size) && defined(_LIBCPP_VERSION)
     1 #if TEST_STD_VER > 17 && defined(__cpp_char8_t) && defined(_LIBCPP_VERSION) && \
     1 #if TEST_STD_VER > 17 && defined(_LIBCPP_VERSION)
     1 #if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_RANGES)
     1 #if TEST_HAS_BUILTIN(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
     1 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
     1 #if !defined(TEST_HAS_NO_EXCEPTIONS) && defined(_LIBCPP_USING_DEV_RANDOM)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117993



More information about the libcxx-commits mailing list