Re: 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')

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 27 Jul 2018 08:23:22 -0700
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
Received on Fri Jul 27 2018 - 13:23:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC