aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFabien Chêne <fabien@gcc.gnu.org>2014-04-09 21:51:17 +0200
committerFabien Chêne <fabien@gcc.gnu.org>2014-04-09 21:51:17 +0200
commit51970b3e3331087ad597ccd3c5df9f788e9fe3e5 (patch)
tree4185d01e85163dfe4b0e683025b0a4d76d49d029 /gcc
parentdbe1eced08e1d0bf5a8e3c8b45410110687a6fe6 (diff)
downloadgcc-51970b3e3331087ad597ccd3c5df9f788e9fe3e5.zip
gcc-51970b3e3331087ad597ccd3c5df9f788e9fe3e5.tar.gz
gcc-51970b3e3331087ad597ccd3c5df9f788e9fe3e5.tar.bz2
pt.c (check_template_variable): Check for the return of pedwarn before emitting a note.
2014-04-09 Fabien Chêne <fabien@gcc.gnu.org> * pt.c (check_template_variable): Check for the return of pedwarn before emitting a note. * parser.c (cp_parser_lambda_introducer): Likewise. From-SVN: r209252
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c8
-rw-r--r--gcc/cp/pt.c8
3 files changed, 14 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4a25ad9..3c09daa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-09 Fabien Chêne <fabien@gcc.gnu.org>
+
+ * 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 <paolo.carlini@oracle.com>
PR c++/59115
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7bea3d2..f386eed 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 eaa4ba2..318c325 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");