This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stdatomic.h and atomic_load_explicit()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]