c-typeck.c (pop_init_level): Improve diagnostics.
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 25 Apr 2012 08:49:23 +0000 (08:49 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 25 Apr 2012 08:49:23 +0000 (08:49 +0000)
2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>

* 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
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20011021-1.c
gcc/testsuite/gcc.dg/m-un-2.c

index c7d8eac13ce047963a99d05c2b505cbdd20f2fdc..a592863fd37e0ecac75034c583283024403ba276 100644 (file)
@@ -1,3 +1,7 @@
+2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * c-typeck.c (pop_init_level): Improve diagnostics.
+
 2012-04-25  Uros Bizjak  <ubizjak@gmail.com>
 
        * compare-elim.c (try_eliminate_compare): Also handle operands with
index fcf751f0b8816972da91a2e3e19e562e0e0938bb..4e5ffbf19057f42a5d2fd480c3ad4882faf2d886 100644 (file)
@@ -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);
          }
     }
 
index 52ab438c398305c77be55d6bcfcc1eacd9b3848d..cce98fa75f89a6ffc1fe97e9477e01965cb3c5a7 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * gcc.dg/m-un-2.c: Update.
+       * gcc.dg/20011021-1.c: Update.
+
 2012-04-25  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/52196
index dc998c8af6186d4facb39aac156a8bd3725daf62..90165c0180c5339f1aaf7f282bc713c3f25beba5 100644 (file)
@@ -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 } */
index 0d280bb57933c84c6421b91a0f9e0442aeb3d1c0..0b96628355b165b885e06624e21297db1031e215 100644 (file)
@@ -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.  */