git: ef03c67b46b6 - stable/14 - stdatomic: Only use clang atomics if __clang__ is defined

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 30 Nov 2024 16:51:12 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef03c67b46b6d441b783c54bfe2d20ab4c12974a

commit ef03c67b46b6d441b783c54bfe2d20ab4c12974a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 17:01:07 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-30 13:55:57 +0000

    stdatomic: Only use clang atomics if __clang__ is defined
    
    GCC 14 defines __has_extension(c_atomic) but does not support
    __c11_atomic_*, so require __clang__ for the CLANG_ATOMICS case.
    
    Reviewed by:    imp, emaste
    Differential Revision:  https://reviews.freebsd.org/D46001
    
    (cherry picked from commit 680f40f38343de118d5b973129683804e496faaf)
---
 sys/sys/stdatomic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/sys/stdatomic.h b/sys/sys/stdatomic.h
index e05606b1ead8..099097ea84a4 100644
--- a/sys/sys/stdatomic.h
+++ b/sys/sys/stdatomic.h
@@ -33,7 +33,8 @@
 #include <sys/cdefs.h>
 #include <sys/_types.h>
 
-#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
+#if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \
+    defined(__clang__)
 #define	__CLANG_ATOMICS
 #elif __GNUC_PREREQ__(4, 7)
 #define	__GNUC_ATOMICS