head -r336568 and -r336570 appears to have made ci.freebsg.org's FreeBSD-head-amd64-gcc fail either than it had been (error: operand type 'struct <anonymous> *' is incompatible with argument 1 of '__atomic_fetch_add')
John Baldwin
jhb at FreeBSD.org
Fri Jul 27 15:23:26 UTC 2018
On 7/27/18 12:12 AM, Mark Millard wrote:
> I was looking too locally: the overall context has an outer #if
> as well that skips the section:
>
> /*
> * Keywords added in C11.
> */
>
> #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
> . . .
> #if !defined(__cplusplus) && !__has_extension(c_atomic) && \
> !__has_extension(cxx_atomic)
> /*
> * No native support for _Atomic(). Place object in structure to prevent
> * most forms of direct non-atomic access.
> */
> #define _Atomic(T) struct { T volatile __val; }
> #endif
> . . .
> #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
Yes. It also means that if we didn't ship the compiler's stdatomic.h and
tried to build with -std=gnu11 or -std=c11 the compile would break.
Rather than requiring c11, another approach might be to fix sys/cdefs.h
and sys/stdatomic.h to actually work with modern GCC by having them not
use the struct for the _GCC_ATOMICS case, only for the _SYNC case.
I think that would fix all of the cases.
--
John Baldwin
More information about the freebsd-current
mailing list