From 9dfcc8db5bd8abeee65a1a5a81e93fed3b49c08e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 19 Jun 1998 22:27:35 +0000 Subject: c-typeck.c (pop_init_level): Warn about implicit zero initialization of struct members. * c-typeck.c (pop_init_level): Warn about implicit zero initialization of struct members. From-SVN: r20614 --- gcc/ChangeLog | 5 +++++ gcc/c-typeck.c | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b93e2d1..376f35a 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 ea2fea8..4ccc1a3 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); -- cgit v1.1