[libcxx-commits] [libcxx] [libc++] Only push/pop diagnostics for ABI annotations pragmas if not in a system header (PR #200338)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 29 00:18:18 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/200338
This should significantly reduce the compile time hit for Clang modules with the new explicit and implicit ABI annotations.
>From 567b03a183b411f8ff301b5566d1ef2e6d76b8a0 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 29 May 2026 09:15:32 +0200
Subject: [PATCH] [libc++] Only push/pop diagnostics for ABI annotations
pragmas if not in a system header
---
libcxx/include/__configuration/namespace.h | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
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