[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:49:32 PDT 2024


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

None

>From bb0fe7bc70f80379af25758f265df3f10dfda2e4 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..7c8e054436919 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 __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