* conditional notes after 'pedwarn'
@ 2014-04-05 10:29 Fabien Chêne
2014-04-07 13:16 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Fabien Chêne @ 2014-04-05 10:29 UTC (permalink / raw)
To: Jason Merrill; +Cc: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
Hi,
Idem than the previous patchlets, this time concerning 'pedwarn'.
Tested x86_64 linux. OK to commit ?
cp/ChangeLog
2014-04-04 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.
--
Fabien
[-- Attachment #2: pedwarn_inform.patch --]
[-- Type: text/x-diff, Size: 1651 bytes --]
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c (révision 209130)
+++ gcc/cp/pt.c (copie de travail)
@@ -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");
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c (révision 209130)
+++ gcc/cp/parser.c (copie de travail)
@@ -8961,10 +8961,10 @@ cp_parser_lambda_introducer (cp_parser*
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-07 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-05 10:29 conditional notes after 'pedwarn' Fabien Chêne
2014-04-07 13:16 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).