[libcxx-commits] [libcxx] 6f3328e - [libc++] Don't add #pragma clang attribute with GCC (#206989)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 22 08:46:18 PDT 2026
Author: Nikolas Klauser
Date: 2026-07-22T17:46:13+02:00
New Revision: 6f3328e869b4d3f11d1b37808fbffab6d822d9aa
URL: https://github.com/llvm/llvm-project/commit/6f3328e869b4d3f11d1b37808fbffab6d822d9aa
DIFF: https://github.com/llvm/llvm-project/commit/6f3328e869b4d3f11d1b37808fbffab6d822d9aa.diff
LOG: [libc++] Don't add #pragma clang attribute with GCC (#206989)
GCC doesn't support `#pragma clang attribute`, which causes a bunch of
diagnostics. Since we have it behind a macro anyways we can simply
define the macro as empty with GCC.
Added:
Modified:
libcxx/include/__configuration/namespace.h
Removed:
################################################################################
diff --git a/libcxx/include/__configuration/namespace.h b/libcxx/include/__configuration/namespace.h
index 6b733e3076581..1f4b8ce247b13 100644
--- a/libcxx/include/__configuration/namespace.h
+++ b/libcxx/include/__configuration/namespace.h
@@ -46,15 +46,20 @@
# define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
#endif
-#define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS \
- _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")
+#ifdef _LIBCPP_COMPILER_CLANG_BASED
+# define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS \
+ _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")
+#else
+# define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
+# define _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
+#endif
// clang-format off
More information about the libcxx-commits
mailing list