Fwd: [PATCH] stdatomic: make atomics compatible with GCC-14

Joel Sherrill joel at rtems.org
Mon Jul 8 13:40:30 UTC 2024


This looks like a newlib patch we want to be sure to pick up in the next
newlib hash update.

---------- Forwarded message ---------
From: Alexey Lapshin <alexey.lapshin at espressif.com>
Date: Mon, Jul 8, 2024 at 2:39 AM
Subject: [PATCH] stdatomic: make atomics compatible with GCC-14
To: newlib at sourceware.org <newlib at sourceware.org>



https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631525.html
brings c_atomic and cxx_atomic definitions into GCC.
This patch makes atomics type detection correct for GCC.
---
 newlib/libc/include/stdatomic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/include/stdatomic.h
b/newlib/libc/include/stdatomic.h
index d58e795eb..fb1a7a0c2 100644
--- a/newlib/libc/include/stdatomic.h
+++ b/newlib/libc/include/stdatomic.h
@@ -33,7 +33,8 @@
 #include <sys/cdefs.h>
 #include <sys/_types.h>

-#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
+#if defined(__clang__) && \
+    (__has_extension(c_atomic) || __has_extension(cxx_atomic))
 #define        __CLANG_ATOMICS
 #elif __GNUC_PREREQ__(4, 7)
 #define        __GNUC_ATOMICS
-- 
2.34.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240708/77d18ee0/attachment.htm>


More information about the devel mailing list