Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] Remove LIBC_HAS_ATTRIBUTE macro #86656

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

vinayakdsci
Copy link
Contributor

Resolves #86547

Replace occurrences of the macro LIBC_HAS_ATTRIBUTE with __has_attribute.

@llvmbot llvmbot added the libc label Mar 26, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 26, 2024

@llvm/pr-subscribers-libc

Author: Vinayak Dev (vinayakdsci)

Changes

Resolves #86547

Replace occurrences of the macro LIBC_HAS_ATTRIBUTE with __has_attribute.


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

2 Files Affected:

  • (modified) libc/src/__support/macros/config.h (-8)
  • (modified) libc/test/src/__support/arg_list_test.cpp (+1-1)
diff --git a/libc/src/__support/macros/config.h b/libc/src/__support/macros/config.h
index fcc8f551a783fe..6666c136669610 100644
--- a/libc/src/__support/macros/config.h
+++ b/libc/src/__support/macros/config.h
@@ -39,12 +39,4 @@
 #define LIBC_HAS_FEATURE(f) 0
 #endif
 
-// Compiler attribute-detection.
-// https://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
-#ifdef __has_attribute
-#define LIBC_HAS_ATTRIBUTE(f) __has_attribute(f)
-#else
-#define LIBC_HAS_ATTRIBUTE(f) 0
-#endif
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_CONFIG_H
diff --git a/libc/test/src/__support/arg_list_test.cpp b/libc/test/src/__support/arg_list_test.cpp
index 1876cf7f70b4b8..4f229e2bfe6940 100644
--- a/libc/test/src/__support/arg_list_test.cpp
+++ b/libc/test/src/__support/arg_list_test.cpp
@@ -120,7 +120,7 @@ TEST(LlvmLibcArgListTest, TestStructTypes) {
 }
 
 // Test vector extensions from clang.
-#if LIBC_HAS_ATTRIBUTE(ext_vector_type)
+#if __has_attribute(ext_vector_type)
 
 using int1 = int __attribute__((ext_vector_type(1)));
 using int2 = int __attribute__((ext_vector_type(2)));

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

Are you able to merge this, or do you need one of us to?

@vinayakdsci
Copy link
Contributor Author

vinayakdsci commented Mar 26, 2024

Thanks!

Are you able to merge this, or do you need one of us to?

No, I will need you to merge it for me :)

@nickdesaulniers nickdesaulniers merged commit a3f21a3 into llvm:main Mar 26, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc] remove LIBC_HAS_ATTRIBUTE
3 participants