[libc-commits] [libc] a73e924 - [libc] use LIBC_HAS_BUILTIN instead __has_builtin (#82377)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 20 08:35:31 PST 2024


Author: Schrodinger ZHU Yifan
Date: 2024-02-20T11:35:27-05:00
New Revision: a73e9244621a6186859644012c295740465ad844

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

LOG: [libc] use LIBC_HAS_BUILTIN instead __has_builtin (#82377)

fix the issue that `__has_builtin` is undefined on some non-clang
targets.

Added: 
    

Modified: 
    libc/src/__support/CPP/atomic.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/CPP/atomic.h b/libc/src/__support/CPP/atomic.h
index c10d06c04bccad..b74cb5981dbaf8 100644
--- a/libc/src/__support/CPP/atomic.h
+++ b/libc/src/__support/CPP/atomic.h
@@ -166,7 +166,7 @@ LIBC_INLINE void atomic_thread_fence([[maybe_unused]] MemoryOrder mem_ord) {
 // except no instructions for memory ordering are issued. Only reordering of
 // the instructions by the compiler is suppressed as order instructs.
 LIBC_INLINE void atomic_signal_fence([[maybe_unused]] MemoryOrder mem_ord) {
-#if __has_builtin(__atomic_signal_fence)
+#if LIBC_HAS_BUILTIN(__atomic_signal_fence)
   __atomic_signal_fence(static_cast<int>(mem_ord));
 #else
   // if the builtin is not ready, use asm as a full compiler barrier.


        


More information about the libc-commits mailing list