Skip to content

Conversation

@philnik777
Copy link
Contributor

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.

@philnik777 philnik777 marked this pull request as ready for review March 29, 2025 21:54
@philnik777 philnik777 requested a review from a team as a code owner March 29, 2025 21:54
@philnik777 philnik777 merged commit abf9c1a into llvm:main Mar 29, 2025
86 checks passed
@philnik777 philnik777 deleted the use_cxx11_attributes branch March 29, 2025 21:55
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 29, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

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 --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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants