[PATCHv2] stdatomic: make atomics compatible with GCC-14

Message ID 5f54ef144f3f55d94728cbea8ea696bcb2d170c9.camel@espressif.com
State New
Headers
Series [PATCHv2] stdatomic: make atomics compatible with GCC-14 |

Commit Message

Alexey Lapshin July 29, 2024, 12:39 p.m. UTC
  From f966d2c1eb6d91b6475862cbace4d773b7a8eb7c Mon Sep 17 00:00:00 2001
From: Alexey Lapshin <alexey.lapshin@espressif.com>
Date: Mon, 8 Jul 2024 14:24:55 +0700
Subject: [PATCH] stdatomic: make atomics compatible with GCC-14

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.

https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf
---
 newlib/libc/include/stdatomic.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.43.0
  

Comments

Alexey Lapshin July 29, 2024, 12:44 p.m. UTC | #1
freebsd got the change https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf
  
Corinna Vinschen July 30, 2024, 12:48 p.m. UTC | #2
On Jul 29 12:39, Alexey Lapshin wrote:
> 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.
> 
> https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf
> ---
>  newlib/libc/include/stdatomic.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Pushed.

Thanks,
Corinna
  

Patch

diff --git a/newlib/libc/include/stdatomic.h b/newlib/libc/include/stdatomic.h
index d58e795eb..af915145c 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 (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \
+    defined(__clang__)
 #define	__CLANG_ATOMICS
 #elif __GNUC_PREREQ__(4, 7)
 #define	__GNUC_ATOMICS