This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: stdatomic.h and atomic_load_explicit()
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Wed, 25 Jun 2014 17:15:37 +0200
- Subject: Re: stdatomic.h and atomic_load_explicit()
- Authentication-results: sourceware.org; auth=none
- References: <53AAAB9C dot 1000304 at embedded-brains dot de> <Pine dot LNX dot 4 dot 64 dot 1406251324070 dot 27516 at digraph dot polyomino dot org dot uk>
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.