[cfe-commits] P4R: Truncate CodeGEn initializer for arrays that are shorter than the initializer

Christopher Lamb christopher.lamb at gmail.com
Fri Nov 30 18:59:11 PST 2007


On Nov 29, 2007, at 3:21 PM, Chris Lattner wrote:

>
> On Nov 29, 2007, at 2:33 PM, Neil Booth wrote:
>
>> Chris Lattner wrote:-
>>
>>>
>>> On Nov 29, 2007, at 7:03 AM, Neil Booth wrote:
>>>
>>>> Christopher Lamb wrote:-
>>>>
>>>>> This allows the following to CodeGen, with warnings:
>>>>>
>>>>> int ary[2] = {1, 2, 3, 4};
>>>>
>>>> Why not just reject outright?  This is clear junk that is better
>>>> flagged to the user as uncompilable than being lost in a sea of
>>>> compiler warning noise.
>>>
>>> The C spec doesn't seem to require this to be rejected, do you
>>> disagree Neil?
>>
>> Sure; it is a violation of constraint 6.7.8p2.
>
> Aha!  Right there... in front... so obvious.  :)  Thanks Neil.
>
> Christopher, can you please change this warning to an extwarn?

What does that mean exactly? If I change the diagnostic type to  
'EXTENSION' then no warning is printed unless the '-pedantic' flag is  
used. GCC warns without extra flags, and it sounds like unless GNU  
extensions are supported this should be an error.

--
Christopher Lamb



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20071130/1ad08a12/attachment.html>


More information about the cfe-commits mailing list