git: 3cbb192a9ee8 - stable/13 - stdatomic: Only use clang atomics if __clang__ is defined

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

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

commit 3cbb192a9ee8118b50fb926592c7caf1888f6b20
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 17:01:07 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-29 19:25:18 +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