diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b93e2d11aac..376f35a899c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 19 23:22:42 1998 Bruno Haible + + * c-typeck.c (pop_init_level): Warn about implicit zero initialization + of struct members. + Fri Jun 19 23:06:33 1998 Jason Merrill * varasm.c (assemble_start_function): Add weak_global_object_name. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index ea2fea84d80..4ccc1a3a5e1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5619,6 +5619,17 @@ pop_init_level (implicit) if (constructor_type != 0) size = int_size_in_bytes (constructor_type); + /* Warn when some struct elements are implicitly initialized to zero. */ + if (extra_warnings + && constructor_type + && TREE_CODE (constructor_type) == RECORD_TYPE + && constructor_unfilled_fields) + { + push_member_name (constructor_unfilled_fields); + warning_init ("missing initializer%s", " for `%s'", NULL); + RESTORE_SPELLING_DEPTH (constructor_depth); + } + /* Now output all pending elements. */ output_pending_init_elements (1);