[libc-commits] [libc] 2146d12 - [libc] fix preferred_type attribute detection (#95599)

via libc-commits libc-commits at lists.llvm.org
Fri Jun 14 13:51:43 PDT 2024


Author: Schrodinger ZHU Yifan
Date: 2024-06-14T13:51:39-07:00
New Revision: 2146d12eb9401d488ad916fc9227b5f24bcfa5c4

URL: https://github.com/llvm/llvm-project/commit/2146d12eb9401d488ad916fc9227b5f24bcfa5c4
DIFF: https://github.com/llvm/llvm-project/commit/2146d12eb9401d488ad916fc9227b5f24bcfa5c4.diff

LOG: [libc] fix preferred_type attribute detection (#95599)

Added: 
    

Modified: 
    libc/src/__support/macros/attributes.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/macros/attributes.h b/libc/src/__support/macros/attributes.h
index 7e8e2ddfac9b1..c6474673de85a 100644
--- a/libc/src/__support/macros/attributes.h
+++ b/libc/src/__support/macros/attributes.h
@@ -42,7 +42,7 @@
 #define LIBC_CONSTINIT
 #endif
 
-#ifdef __clang__
+#if defined(__clang__) && __has_attribute(preferred_type)
 #define LIBC_PREFERED_TYPE(TYPE) [[clang::preferred_type(TYPE)]]
 #else
 #define LIBC_PREFERED_TYPE(TYPE)


        


More information about the libc-commits mailing list