[libcxx-commits] [libcxx] [libc++] Switch a few attribute to use the C++11 syntax (PR #133293)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 29 14:55:29 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
Using the C++11 attribute syntax makes it more strict where attributes can be applied, reducing the number of possible positions an attribute can appear in.
---
Full diff: https://github.com/llvm/llvm-project/pull/133293.diff
1 Files Affected:
- (modified) libcxx/include/__config (+6-6)
``````````diff
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 070298301b0d3..30fe0ef6a3b53 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1157,8 +1157,8 @@ typedef __char32_t char32_t;
# define _LIBCPP_USING_IF_EXISTS
# endif
-# if __has_attribute(__no_destroy__)
-# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
+# if __has_cpp_attribute(_Clang::__no_destroy__)
+# define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]]
# else
# define _LIBCPP_NO_DESTROY
# endif
@@ -1188,14 +1188,14 @@ typedef __char32_t char32_t;
# define _LIBCPP_NO_SPECIALIZATIONS
# endif
-# if __has_attribute(__standalone_debug__)
-# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__))
+# if __has_cpp_attribute(_Clang::__standalone_debug__)
+# define _LIBCPP_STANDALONE_DEBUG [[_Clang::__standalone_debug__]]
# else
# define _LIBCPP_STANDALONE_DEBUG
# endif
-# if __has_attribute(__preferred_name__)
-# define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
+# if __has_cpp_attribute(_Clang::__preferred_name__)
+# define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]
# else
# define _LIBCPP_PREFERRED_NAME(x)
# endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/133293
More information about the libcxx-commits
mailing list