[libcxx-commits] [libcxx] [libc++][NFC] Refactor _LIBCPP_AVAILABILITY_HAS_* macros to always be defined (PR #71002)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 2 09:25:40 PDT 2023


================
@@ -146,28 +146,30 @@
 // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
 //       or once libc++ doesn't use the attribute anymore.
 // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
-#if defined(_LIBCPP_COMPILER_GCC) || defined(_WIN32)
-#  define _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
-#endif
+#  define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1                                       \
+    !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
----------------
ldionne wrote:

I don't think this is valid -- IIRC the argument to a `#if` can't expand to a `defined(...)` check. It works but IIRC it's not pedantically correct. IMO it's also a bit harder to read -- I would recommend doing `#if <...> #else <...> #endif` instead.

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


More information about the libcxx-commits mailing list