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: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Wed, 25 Jun 2014 15:26:51 +0000
- 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> <53AAE799 dot 20004 at embedded-brains dot de>
On Wed, 25 Jun 2014, Sebastian Huber wrote:
> In case __auto_type discards const and volatile qualifiers, then shouldn't
> this generate a warning (-Wconst-qual)
>
> __auto_type __atomic_load_ptr = (PTR);
>
> ?
No. The discarding is for qualifiers on the type itself (remembering that
qualifiers on rvalues aren't that well-defined in ISO C), not on the
target of any pointer.
> 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__.
__auto_type is, by design, meant to be consistent with typeof (while
avoiding multiple evaluation when VLAs are involved, as well as avoiding
exponential blowup of the size of the expansion with nested calls to
macros).
--
Joseph S. Myers
joseph@codesourcery.com