From 3235f8eb131f5cce00ecab1c0b022affb7d4b0bc Mon Sep 17 00:00:00 2001 From: fabien Date: Wed, 9 Apr 2014 19:51:17 +0000 Subject: [PATCH] =?utf8?q?2014-04-09=20=20Fabien=20Ch=C3=AAne=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * pt.c (check_template_variable): Check for the return of pedwarn before emitting a note. * parser.c (cp_parser_lambda_introducer): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209252 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 8 ++++---- gcc/cp/pt.c | 8 ++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4a25ad94e4d..3c09daa3f64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-04-09 Fabien ChĂȘne + + * pt.c (check_template_variable): Check for the return of pedwarn + before emitting a note. + * parser.c (cp_parser_lambda_introducer): Likewise. + 2014-04-08 Paolo Carlini PR c++/59115 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7bea3d20029..f386eed275d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8961,10 +8961,10 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) if (VAR_P (capture_init_expr) && decl_storage_duration (capture_init_expr) != dk_auto) { - pedwarn (capture_token->location, 0, "capture of variable " - "%qD with non-automatic storage duration", - capture_init_expr); - inform (0, "%q+#D declared here", capture_init_expr); + if (pedwarn (capture_token->location, 0, "capture of variable " + "%qD with non-automatic storage duration", + capture_init_expr)) + inform (0, "%q+#D declared here", capture_init_expr); continue; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index eaa4ba2824e..318c32507ef 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2304,10 +2304,10 @@ check_template_variable (tree decl) "%qD is not a static data member of a class template", decl); else if (template_header_count > wanted) { - pedwarn (DECL_SOURCE_LOCATION (decl), 0, - "too many template headers for %D (should be %d)", - decl, wanted); - if (CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx)) + bool warned = pedwarn (DECL_SOURCE_LOCATION (decl), 0, + "too many template headers for %D (should be %d)", + decl, wanted); + if (warned && CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx)) inform (DECL_SOURCE_LOCATION (decl), "members of an explicitly specialized class are defined " "without a template header"); -- 2.11.4.GIT