[libcxx-commits] [libcxx] [libcxx] sort `_LIBCPP_INTRODUCED_IN_LLVM_<X>` usages in reverse chronological order (PR #176857)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 20 07:21:13 PST 2026


================
@@ -280,20 +249,17 @@
 #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
 #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
 
-// This controls the availability of floating-point std::from_chars functions.
-// These overloads were added later than the integer overloads.
-#define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
-#define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
-
-// This controls whether `std::__hash_memory` is available in the dylib, which
-// is used for some `std::hash` specializations.
-#define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21
-// No attribute, since we've had hash in the headers before
+// These macros controls the availability of __cxa_init_primary_exception
+// in the built library, which std::make_exception_ptr might use
+// (see libcxx/include/__exception/exception_ptr.h).
+#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
+#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
 
-// This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`.
-// See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib.
-#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
-// No attribute, since we've had bad_function_call::what() in the headers before
+// This controls the availability of C++23 <print>, which
+// has a dependency on the built library (it needs access to
+// the underlying buffer types of std::cout, std::cerr, and std::clog.
+#define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18
+#define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
 
 // Define availability attributes that depend on both
 // _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
----------------
ldionne wrote:

In the same vein as Nikolas is suggesting, let's make a pre-requisite PR that removes this block. This can be done by replacing uses of `_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION` in the code by

```
_LIBCPP_HAS_EXCEPTIONS && _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
```

Then this patch will be a clearer re-ordering.

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


More information about the libcxx-commits mailing list