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

James Y Knight via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 10:35:12 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
----------------
jyknight wrote:

I disagree with this resolution.

In order for these values to be at all useful, we MUST reserve the ability to change these values arbitrarily based on CPU tuning flags or in new compiler versions. If we end up having a release (of clang OR libc++) that exposes these values without a warning, I think that is indeed likely to result in users triggering ODR problems. 

But, the answer to this problem must be to implement a diagnostic to try to avoid ODR issues, not to hide that the values might vary across TUs in the documentation.

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


More information about the cfe-commits mailing list