[libcxx-commits] [libcxx] [libcxxabi] [libc++][RFC] Always define internal feature test macros (PR #89178)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 19 09:22:43 PDT 2024


================
@@ -214,10 +214,9 @@
 #define TEST_IS_EXECUTED_IN_A_SLOW_ENVIRONMENT
 #endif
 
-#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \
-  (!(TEST_STD_VER > 14 || \
-    (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L)))
-#define TEST_HAS_NO_ALIGNED_ALLOCATION
+#if (!defined(_LIBCPP_HAS_ALIGNED_ALLOCATION) || !_LIBCPP_HAS_ALIGNED_ALLOCATION) ||                                   \
+    (!(TEST_STD_VER > 14 || (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L)))
+#  define TEST_HAS_NO_ALIGNED_ALLOCATION
----------------
ldionne wrote:

I think I would split this a bit to make it easier to understand. Also, I think it's a bit wrong how it was refactored. Instead:

```
#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_ALIGNED_ALLOCATION
#  define TEST_HAS_NO_ALIGNED_ALLOCATION
#elif TEST_STD_VER < 17 && (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L)
#  define TEST_HAS_NO_ALIGNED_ALLOCATION
#endif
```

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


More information about the libcxx-commits mailing list