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

via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 29 03:47:43 PDT 2026


Author: Nikolas Klauser
Date: 2026-05-29T12:47:37+02:00
New Revision: fad51d3f41482e148683e12741ac9abfbe49742d

URL: https://github.com/llvm/llvm-project/commit/fad51d3f41482e148683e12741ac9abfbe49742d
DIFF: https://github.com/llvm/llvm-project/commit/fad51d3f41482e148683e12741ac9abfbe49742d.diff

LOG: [libc++] Only push/pop diagnostics for ABI annotations pragmas if not in a system header (#200338)

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

Added: 
    

Modified: 
    libcxx/include/__configuration/namespace.h

Removed: 
    


################################################################################
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")
 


        


More information about the libcxx-commits mailing list