On Mon, Jun 02, 2014 at 12:58:53AM -0400, S. Gilles wrote: Thanks for tackling this.
> @@ -6858,6 +6858,9 @@ > /* 1 if this constructor is erroneous so far. */ > static int constructor_erroneous; > > +/* 1 if this constructor is the universal zero initializer { 0 } */ ". */" at the end of the comment, please. > @@ -7317,12 +7321,8 @@ > set_nonincremental_init (braced_init_obstack); > } > > - if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned) > - { > - missing_braces_mentioned = 1; > - warning_init (input_location, OPT_Wmissing_braces, > - "missing braces around initializer"); > - } > + if (implicit == 1) > + found_missing_braces = 1; Wrong indentation, there should be only two spaces. > + /* Warn when some structs are initialized with direct aggregation. */ > + if (!implicit && found_missing_braces && warn_missing_braces > + && !constructor_zeroinit) > + { > + warning_init (input_location, OPT_Wmissing_braces, > + "missing braces around initializer"); > + } > + Please use "loc" instead of input_location. > @@ -8594,6 +8598,11 @@ > designator_depth = 0; > designator_erroneous = 0; > > + if (!implicit && value.value && !integer_zerop (value.value)) > + { > + constructor_zeroinit = 0; > + } > + You can drop the braces here. But the problem I see is that this patch treats even "{ 0, 0 }" as a "universal zero initializer", thus we wouldn't warn on say: /* -Wmissing-braces -Wmissing-field-initializers */ struct T { int a, b; }; struct U { int a, b; struct T t; }; void f (void) { int a[2][2][2] = { 0, 0, 0 }; struct U u = { 0, 0 }; } I'm not sure whether that is desirable. Marek