[libcxx-commits] [libcxx] [libc++] Only push/pop diagnostics for ABI annotations pragmas if not in a system header (PR #200338)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 29 00:18:56 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

This should significantly reduce the compile time hit for Clang modules with the new explicit and implicit ABI annotations.


---
Full diff: https://github.com/llvm/llvm-project/pull/200338.diff


1 Files Affected:

- (modified) libcxx/include/__configuration/namespace.h (+12-7) 


``````````diff
diff --git a/libcxx/include/__configuration/namespace.h b/libcxx/include/__configuration/namespace.h
index befb64ac5903e..6b733e3076581 100644
--- a/libcxx/include/__configuration/namespace.h
+++ b/libcxx/include/__configuration/namespace.h
@@ -35,19 +35,24 @@
     _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")                                                               \
     _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
 #  define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
+#  define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS                                                                          \
+    _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpragma-clang-attribute")                               \
+        _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wignored-attributes")
+#  define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
 #else
 #  define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
 #  define _LIBCPP_POP_EXTENSION_DIAGNOSTICS
+#  define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS
+#  define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
 #endif
 
 #define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS                                                                           \
-  _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpragma-clang-attribute")                                 \
-      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wignored-attributes")                                                         \
-          _Pragma(_LIBCPP_TOSTRING(clang attribute _LibcxxExplicitABIAnnotations.push(                                 \
-              __attribute__((__exclude_from_explicit_instantiation__,                                                  \
-                             __visibility__("hidden"),                                                                 \
-                             __abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))),                                   \
-              apply_to = function))) _LIBCPP_DIAGNOSTIC_POP
+  _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS                                                                                  \
+  _Pragma(_LIBCPP_TOSTRING(clang attribute _LibcxxExplicitABIAnnotations.push(                                         \
+      __attribute__((__exclude_from_explicit_instantiation__,                                                          \
+                     __visibility__("hidden"),                                                                         \
+                     __abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))),                                           \
+      apply_to = function))) _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
 
 #define _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS _Pragma("clang attribute _LibcxxExplicitABIAnnotations.pop")
 

``````````

</details>


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


More information about the libcxx-commits mailing list