[clang] [libcxx] [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (PR #89446)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 10:43:53 PDT 2024


================
@@ -89,6 +89,19 @@ sections with improvements to Clang's support for those languages.
 C++ Language Changes
 --------------------
 
+C++17 Feature Support
+^^^^^^^^^^^^^^^^^^^^^
+- Clang now exposes ``__GCC_DESTRUCTIVE_SIZE`` and ``__GCC_CONSTRUCTIVE_SIZE``
+  predefined macros to support standard library implementations of
+  ``std::hardware_destructive_interference_size`` and
+  ``std::hardware_constructive_interference_size``, respectively. These macros
+  are predefined in all C and C++ language modes. These macros can be
+  overridden on the command line with ``-D``, if desired. The values the macros
----------------
cor3ntin wrote:

My comment was only to not encourage using `-D`. The fact it's defined through a macro is really an implementation details, the macro is not meant to be user facing.

As for whether we need something specific for ODR here... we certainly do not for other abi-impacting feature.
you can already get into issues if the target is different in different TUs. Or if any define is different across TUs
(C++ modules already catch that sort of ODR issues when use in alignas etc)

I'm also not sure whether we usually warn when undocumented macros are used.

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


More information about the cfe-commits mailing list