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

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Fri Jun 14 13:50:31 PDT 2024


https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/95599

>From aa8fe4eb559c5ad9eee916ba07453948dba546cc Mon Sep 17 00:00:00 2001
From: Yifan Zhu <yifzhu at nvidia.com>
Date: Fri, 14 Jun 2024 13:48:53 -0700
Subject: [PATCH] [libc] fix preferred_type attribute detection

---
 libc/src/__support/macros/attributes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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