diff mbox

conditional notes after 'warning'

Message ID CAFH4-djZf=kP4PxTw035YZ9wQgE5vR5xai6rOWZzgVW3fnN-sw@mail.gmail.com
State New
Headers show

Commit Message

Fabien Chêne April 4, 2014, 12:01 p.m. UTC
Hi,

Following the previous patchlet about conditional notes after
'permerror', same cleanup with 'warning'. Tested x86_64 linux without
regressions. OK to commit ?

cp/ChangeLog

2014-04-04  Fabien Chêne  <fabien@gcc.gnu.org>

    * class.c (find_abi_tags_r): Check for the return of warning
    before emitting a note.
    (one_inherited_ctor): Likewise.

Comments

Jason Merrill April 4, 2014, 2:19 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(révision 209070)
+++ gcc/cp/class.c	(copie de travail)
@@ -1385,19 +1385,21 @@  find_abi_tags_r (tree *tp, int *walk_sub
 	      /* Otherwise we're diagnosing missing tags.  */
 	      else if (TYPE_P (p->subob))
 		{
-		  warning (OPT_Wabi_tag, "%qT does not have the %E abi tag "
-			   "that base %qT has", p->t, tag, p->subob);
-		  inform (location_of (p->subob), "%qT declared here",
-			  p->subob);
+		  if (warning (OPT_Wabi_tag, "%qT does not have the %E abi tag "
+			       "that base %qT has", p->t, tag, p->subob))
+		    inform (location_of (p->subob), "%qT declared here",
+			    p->subob);
 		}
 	      else
 		{
-		  warning (OPT_Wabi_tag, "%qT does not have the %E abi tag "
-			   "that %qT (used in the type of %qD) has",
-			   p->t, tag, *tp, p->subob);
-		  inform (location_of (p->subob), "%qD declared here",
-			  p->subob);
-		  inform (location_of (*tp), "%qT declared here", *tp);
+		  if (warning (OPT_Wabi_tag, "%qT does not have the %E abi tag "
+			       "that %qT (used in the type of %qD) has",
+			       p->t, tag, *tp, p->subob))
+		    {
+		      inform (location_of (p->subob), "%qD declared here",
+			      p->subob);
+		      inform (location_of (*tp), "%qT declared here", *tp);
+		    }
 		}
 	    }
 	}
@@ -3083,9 +3085,9 @@  one_inherited_ctor (tree ctor, tree t)
   one_inheriting_sig (t, ctor, new_parms, i);
   if (parms == NULL_TREE)
     {
-      warning (OPT_Winherited_variadic_ctor,
-	       "the ellipsis in %qD is not inherited", ctor);
-      inform (DECL_SOURCE_LOCATION (ctor), "%qD declared here", ctor);
+      if (warning (OPT_Winherited_variadic_ctor,
+		   "the ellipsis in %qD is not inherited", ctor))
+	inform (DECL_SOURCE_LOCATION (ctor), "%qD declared here", ctor);
     }
 }