On Fri, 17 Oct 2014, Marek Polacek wrote:

> Building Linux kernel failed with 'error: initializer element is not
> constant', because they're initializing objects with static storage
> duration with (T){ ...} - and that isn't permitted in gnu99/gnu11.
> 
> I think the Right Thing is to allow some latitude here and enable it
> even in gnu99/gnu11 unless -pedantic.  In gnu89, this will work as
> before even with -pedantic.

The Right Thing is for -pedantic not to cause errors, only warnings 
(-pedantic-errors being needed for an error).  So rather than having this 
conditional for whether to allow the extension at all, make the 
conditional code do a pedwarn (if flag_isoc99, otherwise there will 
already have been one for using a compound literal at all, and not for 
VECTOR_TYPE).  (I don't believe this can affect the semantics of valid 
code; in this case of require_constant with a compound literal, we know 
the code is invalid in ISO C terms, so it's safe to diagnose it then 
interpret it in a sensible way.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to