+2014-10-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/63480
+ * c-typeck.c (pop_init_level): Don't warn about initializing
+ with { }.
+
2014-10-07 Marek Polacek <polacek@redhat.com>
PR c/59717
}
}
- if (vec_safe_length (constructor_elements) != 1)
+ /* Initialization with { } counts as zeroinit. */
+ if (vec_safe_length (constructor_elements) == 0)
+ constructor_zeroinit = 1;
+ /* If the constructor has more than one element, it can't be { 0 }. */
+ else if (vec_safe_length (constructor_elements) != 1)
constructor_zeroinit = 0;
/* Warn when some structs are initialized with direct aggregation. */
/* Do not warn if this level of the initializer uses member
designators; it is likely to be deliberate. */
&& !constructor_designated
- /* Do not warn about initializing with ` = {0}'. */
+ /* Do not warn about initializing with { 0 } or with { }. */
&& !constructor_zeroinit)
{
if (warning_at (input_location, OPT_Wmissing_field_initializers,
+2014-10-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/63480
+ * gcc.dg/pr63480.c: New test.
+
2014-10-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/63445
--- /dev/null
+/* PR c/63480 */
+/* { dg-do compile } */
+/* { dg-options "-Wmissing-field-initializers" } */
+
+/* Test that we don't warn about initializing with { }. */
+
+struct S { int a, b, c; } s = { };
+
+void
+foo (void)
+{
+ struct S s = { };
+ struct S s2 = (struct S){ };
+}