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

Vinayak Dev via libc-commits libc-commits at lists.llvm.org
Tue Mar 26 04:59:51 PDT 2024


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

Resolves #86547 

Replace occurrences of the macro `LIBC_HAS_ATTRIBUTE` with `__has_attribute`.

>From a5979c4223f076c55749d84cb67a8c3a8cc0ca36 Mon Sep 17 00:00:00 2001
From: Vinayak Dev <vinayakdev.sci at gmail.com>
Date: Tue, 26 Mar 2024 17:20:44 +0530
Subject: [PATCH] [libc] Remove LIBC_HAS_ATTRIBUTE macro

---
 libc/src/__support/macros/config.h        | 8 --------
 libc/test/src/__support/arg_list_test.cpp | 2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)

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



More information about the libc-commits mailing list