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

Sebastian Huber <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hello Alexey,

this file was imported from FreeBSD. So, it would be good to fix this issue first in FreeBSD.

If GCC provides the c_atomic and cxx_atomic extensions, then why can't we use them for this header file?

Independent of this, GCC provides its own stdatomic.h header file for a while which should be found before the Newlib header if you use standard compiler search paths.

----- Am 8. Jul 2024 um 9:38 schrieb Alexey Lapshin [email protected]:

> 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

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: [email protected]
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.