From 32397f22f0adc823b4df39b3381424ba7855828f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Wed, 25 Apr 2012 08:49:23 +0000 Subject: [PATCH] c-typeck.c (pop_init_level): Improve diagnostics. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2012-04-25 Manuel López-Ibáñez * c-typeck.c (pop_init_level): Improve diagnostics. testsuite/ * gcc.dg/m-un-2.c: Update. * gcc.dg/20011021-1.c: Update. From-SVN: r186807 --- gcc/ChangeLog | 4 ++++ gcc/c-typeck.c | 10 ++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/20011021-1.c | 2 +- gcc/testsuite/gcc.dg/m-un-2.c | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7d8eac13ce..a592863fd37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2012-04-25 Manuel López-Ibáñez + + * c-typeck.c (pop_init_level): Improve diagnostics. + 2012-04-25 Uros Bizjak * compare-elim.c (try_eliminate_compare): Also handle operands with diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index fcf751f0b88..4e5ffbf1905 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -7060,10 +7060,12 @@ pop_init_level (int implicit, struct obstack * braced_init_obstack) /* Do not warn about initializing with ` = {0}'. */ && !constructor_zeroinit) { - push_member_name (constructor_unfilled_fields); - warning_init (OPT_Wmissing_field_initializers, - "missing initializer"); - RESTORE_SPELLING_DEPTH (constructor_depth); + if (warning_at (input_location, OPT_Wmissing_field_initializers, + "missing initializer for field %qD of %qT", + constructor_unfilled_fields, + constructor_type)) + inform (DECL_SOURCE_LOCATION (constructor_unfilled_fields), + "%qT declared here", constructor_unfilled_fields); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52ab438c398..cce98fa75f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-04-25 Manuel López-Ibáñez + + * gcc.dg/m-un-2.c: Update. + * gcc.dg/20011021-1.c: Update. + 2012-04-25 Tobias Burnus PR fortran/52196 diff --git a/gcc/testsuite/gcc.dg/20011021-1.c b/gcc/testsuite/gcc.dg/20011021-1.c index dc998c8af61..90165c0180c 100644 --- a/gcc/testsuite/gcc.dg/20011021-1.c +++ b/gcc/testsuite/gcc.dg/20011021-1.c @@ -42,4 +42,4 @@ struct multilevel M = { .n = 9 }, /* { dg-bogus "initialization of union" } */ /* "string here" */ }; /* { dg-warning "missing init" } */ -/* { dg-warning "near init" "near init" { target *-*-* } 44 } */ +/* { dg-message "declared here" "near init" { target *-*-* } 27 } */ diff --git a/gcc/testsuite/gcc.dg/m-un-2.c b/gcc/testsuite/gcc.dg/m-un-2.c index 0d280bb5793..0b96628355b 100644 --- a/gcc/testsuite/gcc.dg/m-un-2.c +++ b/gcc/testsuite/gcc.dg/m-un-2.c @@ -16,7 +16,7 @@ struct vtable mtable = { malloc, free }; /* { dg-warning "missing initializer" "warning regression" { target *-*-* } {18} } */ - /* { dg-warning "initialization for 'mtable._realloc'" "warning regression 2" { target *-*-* } {18} } */ + /* { dg-message "declared here" "warning regression 2" { target *-*-* } {12} } */ /* With designated initializers, we assume you meant to leave out the initialization of any blank fields. */ -- 2.30.2