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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/95599.diff


1 Files Affected:

- (modified) libc/src/__support/macros/attributes.h (+1-1) 


``````````diff
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)

``````````

</details>


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


More information about the libc-commits mailing list