/* 1 if have called defer_addressed_constants. */
static int constructor_subconstants_deferred;
+/* 1 if this constructor is a zero init. */
+static int constructor_zeroinit;
+
/* Structure for managing pending initializer elements, organized as an
AVL tree. */
set_nonincremental_init ();
}
- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
- {
- missing_braces_mentioned = 1;
- warning_init ("missing braces around initializer");
- }
-
if (TREE_CODE (constructor_type) == RECORD_TYPE
|| TREE_CODE (constructor_type) == UNION_TYPE)
{
abort ();
}
+ if (constructor_elements == 0)
+ constructor_zeroinit = 1;
+ else if (TREE_CHAIN (constructor_elements) == 0 &&
+ initializer_zerop (TREE_VALUE (constructor_elements)))
+ {
+ constructor_zeroinit = 1;
+ }
+ else
+ constructor_zeroinit = 0;
+
+ /* only warn for missing braces unless it is { 0 } */
+ if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned &&
+ !constructor_zeroinit)
+ {
+ missing_braces_mentioned = 1;
+ warning_init ("missing braces around initializer");
+ }
+
/* Warn when some struct elements are implicitly initialized to zero. */
if (extra_warnings
&& constructor_type