From: Mark Mitchell Date: Fri, 11 Feb 2005 17:20:01 +0000 (+0000) Subject: re PR c++/19755 (-Wmissing-braces doesn't warn anymore) X-Git-Tag: releases/gcc-3.4.4~234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=892108875213e0574b4149386f95a144b62d1f34;p=thirdparty%2Fgcc.git re PR c++/19755 (-Wmissing-braces doesn't warn anymore) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 88c7a3623dd4..3dd309960dc5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-02-10 Mark Mitchell + + PR c++/19755 + * decl.c (reshape_init): Issue warnings about missing braces. + 2005-02-09 Mark Mitchell * parser.c (cp_parser_unqualified_id): Initialize type_decl. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 61b618258d85..5ccf3f85faf1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f14579324c4..d4593ebe8ef1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-02-10 Mark Mitchell + + PR c++/19755 + * decl.c (reshape_init): Issue warnings about missing braces. + 2005-02-10 Jakub Jelinek PR rtl-optimization/19579