[libcxx-commits] [libcxx] [libc++] Guard explicit ABI annotations for Clang >= 21 (PR #212249)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 27 06:38:30 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Milad Fa (miladfarca)

<details>
<summary>Changes</summary>

Clang < 21 doesn't support `__visibility__` with #pragma clang attribute
(PragmaAttributeSupport was added in afc6c2bb9b43). Since the macro
already has an empty fallback for gcc (added by 6f3328e), gate it on the required version.

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


1 Files Affected:

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


``````````diff
diff --git a/libcxx/include/__configuration/namespace.h b/libcxx/include/__configuration/namespace.h
index 1f4b8ce247b13..032c16e358aa3 100644
--- a/libcxx/include/__configuration/namespace.h
+++ b/libcxx/include/__configuration/namespace.h
@@ -46,7 +46,7 @@
 #  define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
 #endif
 
-#ifdef _LIBCPP_COMPILER_CLANG_BASED
+#if defined(_LIBCPP_COMPILER_CLANG_BASED) && (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2101)
 #  define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS                                                                         \
     _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS                                                                                \
     _Pragma(_LIBCPP_TOSTRING(clang attribute _LibcxxExplicitABIAnnotations.push(                                       \

``````````

</details>


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


More information about the libcxx-commits mailing list