This is the mail archive of the gcc-patches@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: [C] improve missing initializers diagnostics


On 25 April 2012 18:08, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> On 25 April 2012 16:46, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sat, Apr 21, 2012 at 4:58 AM, Manuel López-Ibáñez
>> <lopezibanez@gmail.com> wrote:
>>> This patch improves missing initializers diagnostics. From:
>>>
>>> pr36446.c:13:3: warning: missing initializer [-Wmissing-field-initializers]
>>> ? .h = {1},
>>> ? ^
>>> pr36446.c:13:3: warning: (near initialization for ‘m0.h.b’)
>>> [-Wmissing-field-initializers]
>>> ? .h = {1},
>>> ? ^
>>>
>>> to:
>>>
>>> pr36446.c:13:3: warning: missing initializer for field ‘b’ of ‘struct
>>> h’ [-Wmissing-field-initializers]
>>> ? .h = {1},
>>> ? ^
>>> pr36446.c:3:7: note: ‘b’ declared here
>>> ? int b;
>>> ? ? ? ^
>>>
>>> Bootstrapped/regression tested.
>>>
>>> OK?
>>>
>>>
>>> 2012-04-19 ?Manuel López-Ibáñez ?<manu@gcc.gnu.org>
>>>
>>> ? ? ? ?* c-typeck.c (pop_init_level): Improve diagnostics.
>>> testsuite/
>>> ? ? ? ?* gcc.dg/m-un-2.c: Update.
>>> ? ? ? ?* gcc.dg/20011021-1.c: Update.
>>
>> On Linux/x86, revision 186808 gave me:
>>
>> FAIL: gcc.dg/20011021-1.c ?(test for warnings, line 34)
>> FAIL: gcc.dg/20011021-1.c ?(test for warnings, line 41)
>> FAIL: gcc.dg/20011021-1.c ?(test for warnings, line 44)
>> FAIL: gcc.dg/20011021-1.c (test for excess errors)
>> FAIL: gcc.dg/20011021-1.c near init (test for warnings, line 27)
>> FAIL: gcc.dg/20011021-1.c near init (test for warnings, line 30)
>> FAIL: gcc.dg/m-un-2.c (test for excess errors)
>> FAIL: gcc.dg/m-un-2.c warning regression 2 (test for warnings, line 12)
>> FAIL: gcc.dg/missing-field-init-2.c ?(test for warnings, line 14)
>> FAIL: gcc.dg/missing-field-init-2.c ?(test for warnings, line 7)
>> FAIL: gcc.dg/missing-field-init-2.c ?(test for warnings, line 8)
>> FAIL: gcc.dg/missing-field-init-2.c (test for excess errors)
>>
>> Revision 186806 is OK.
>
> Somehow I committed a broken version of the patch. It should have been this:
>
>
> --- gcc/c-typeck.c ? ? ?(revision 186821)
> +++ gcc/c-typeck.c ? ? ?(working copy)
> @@ -7063,11 +7063,11 @@ pop_init_level (int implicit, struct obs
> ? ? ? ? ? ?if (warning_at (input_location, OPT_Wmissing_field_initializers,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?"missing initializer for field %qD of %qT",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?constructor_unfilled_fields,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?constructor_type))
> ? ? ? ? ? ? ?inform (DECL_SOURCE_LOCATION (constructor_unfilled_fields),
> - ? ? ? ? ? ? ? ? ? ? "%qT declared here", constructor_unfilled_fields);
> + ? ? ? ? ? ? ? ? ? ? "%qD declared here", constructor_unfilled_fields);
> ? ? ? ? ?}
> ? ? }
>
>
> I'll commit as soon as it finishes bootstrapping+testing.

Committed as revision 186896.

Cheers,

Manuel.


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