[libc-commits] [libc] [libc] Remove LIBC_HAS_ATTRIBUTE macro (PR #86656)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 26 05:00:30 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Vinayak Dev (vinayakdsci)

<details>
<summary>Changes</summary>

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

``````````

</details>


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


More information about the libc-commits mailing list