Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jul 2018 08:23:22 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        Konstantin Belousov <kib@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   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')
Message-ID:  <d57c97fc-f9dc-37c9-09fe-66ca6f72e344@FreeBSD.org>
In-Reply-To: <1E03ECE7-297C-4D40-BC58-FB1903538181@yahoo.com>
References:  <AED126D8-AFB9-4BF6-81AF-A3CE5F16D2AB@yahoo.com> <EDDB87CC-3CC6-4A71-AF6D-B193F26BB692@yahoo.com> <95fdbf29-6c11-77a6-27a3-2d0dc30f1668@FreeBSD.org> <788B1EE7-EFC9-4AD4-9FD1-9876D0121189@yahoo.com> <9D40F38E-F1DC-4A3F-8792-09AD30D8802B@yahoo.com> <D06CD69A-F0E5-4935-8B64-D1ADB7B6D90A@yahoo.com> <1ea2a8d0-b27a-503a-0a8b-48d7fbcd8fcb@FreeBSD.org> <0103123A-2D77-4D64-8FF6-97CD521CA7A8@yahoo.com> <11b515f2-5777-f983-bec5-e60bceda06ab@FreeBSD.org> <6DB0B921-30C8-4BF5-B610-770C0CBF1174@yahoo.com> <E3CFA058-D879-4E25-A8BA-C052803AE509@yahoo.com> <462BE582-0C2E-4D40-92F3-A27155777E58@yahoo.com> <1E03ECE7-297C-4D40-BC58-FB1903538181@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d57c97fc-f9dc-37c9-09fe-66ca6f72e344>