git: 680f40f38343 - main - stdatomic: Only use clang atomics if __clang__ is defined

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 19 Jul 2024 17:07:40 UTC
The branch main has been updated by jhb:

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

commit 680f40f38343de118d5b973129683804e496faaf
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 17:01:07 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-07-19 17:05:52 +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
---
 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