stdatomic.h and atomic_load_explicit()
Sebastian Huber
sebastian.huber@embedded-brains.de
Wed Jun 25 15:15:00 GMT 2014
On 2014-06-25 15:25, Joseph S. Myers wrote:
> On Wed, 25 Jun 2014, Sebastian Huber wrote:
>
>> I think the inheritance of the volatile qualifier via __typeof__
>> (*__atomic_load_ptr) is an implementation flaw.
>
> See the comment in c_parser_typeof_specifier:
>
> /* For use in macros such as those in <stdatomic.h>, remove
> _Atomic and const qualifiers from atomic types. (Possibly
> all qualifiers should be removed; const can be an issue for
> more macros using typeof than just the <stdatomic.h>
> ones.) */
>
> (If changing this, remember to change the __auto_type handling as well.)
>
Thanks for the hint. I sent a patch to the list.
https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02026.html
In case __auto_type discards const and volatile qualifiers, then shouldn't this
generate a warning (-Wconst-qual)
__auto_type __atomic_load_ptr = (PTR);
?
Why is it necessary to discard the const and/or volatile qualifiers in the
__auto_type at all? I think for <stdatomic.h> it should be sufficient to
discard them only in __typeof__.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the Gcc
mailing list