]> sourceware.org Git - newlib-cygwin.git/commit
Make the system C11 atomics headers fully compatible with external GCC.
authorjhb <jhb@FreeBSD.org>
Mon, 6 Aug 2018 23:51:08 +0000 (23:51 +0000)
committerSebastian Huber <sebastian.huber@embedded-brains.de>
Mon, 26 Oct 2020 13:18:45 +0000 (14:18 +0100)
commitc25de3a3c51e3d27133947a3d943c2a2127445d5
tree18785f5ede5482f18a4fec4426f83901dc64797a
parent7b996f807e0be210acddfd5e34e171e98321de8b
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585
newlib/libc/include/stdatomic.h
newlib/libc/include/sys/cdefs.h
This page took 0.02944 seconds and 5 git commands to generate.