]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19755 (-Wmissing-braces doesn't warn anymore)
authorMark Mitchell <mark@codesourcery.com>
Fri, 11 Feb 2005 17:20:01 +0000 (17:20 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 11 Feb 2005 17:20:01 +0000 (17:20 +0000)
PR c++/19755
* decl.c (reshape_init): Issue warnings about missing braces.

PR c++/19755
* g++.dg/warn/Wbraces1.C: New test.

From-SVN: r94884

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog

index 88c7a3623dd4690ba7ba3e2cb19fd3c6a07aace2..3dd309960dc5d90d64701f44e400c20d9c203acc 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/19755
+       * decl.c (reshape_init): Issue warnings about missing braces.
+
 2005-02-09  Mark Mitchell  <mark@codesourcery.com>
 
        * parser.c (cp_parser_unqualified_id): Initialize type_decl.
index 61b618258d854e2275f0a8a53bdc6c58bef66383..5ccf3f85faf11939a615051a190040dabe9c63b1 100644 (file)
@@ -4442,10 +4442,15 @@ reshape_init (tree type, tree *initp)
        new_init = build_tree_list (TREE_PURPOSE (old_init), new_init);
     }
 
-  /* If this was a brace-enclosed initializer and all of the
-     initializers were not used up, there is a problem.  */
-  if (brace_enclosed_p && *initp)
-    error ("too many initializers for `%T'", type);
+  /* If there are more initializers than necessary, issue a
+     diagnostic.  */  
+  if (*initp)
+    {
+      if (brace_enclosed_p)
+       error ("too many initializers for %qT", type);
+      else if (warn_missing_braces)
+       warning ("missing braces around initializer");
+    }
 
   return new_init;
 }
index 3f14579324c4994881b46408d926e61b03fdddbe..d4593ebe8ef14be873dfe756e9c0228cf565a15e 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/19755
+       * decl.c (reshape_init): Issue warnings about missing braces.
+
 2005-02-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/19579