diff mbox

[C++] Avoid a few more '+' in warnings

Message ID 5761B377.9080904@oracle.com
State New
Headers show

Commit Message

Paolo Carlini June 15, 2016, 7:58 p.m. UTC
Hi,

looks like last year I forgot to grep for %q+F and %q+#F. Tested 
x86_64-linux. Should be obvious...

Thanks,
Paolo.

//////////////////////
2016-06-15  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (wrapup_globals_for_namespace): Use DECL_SOURCE_LOCATION and
	"%qF" in warning_at instead of "%q+F" in warning.
	(check_redeclaration_exception_specification): Likewise in pedwarn
	(and error, inform, for consistency).
	* call.c (joust): Likewise.

Comments

Jason Merrill June 15, 2016, 8:07 p.m. UTC | #1
Yep, that looks obvious.

Jason
diff mbox

Patch

Index: call.c
===================================================================
--- call.c	(revision 237318)
+++ call.c	(working copy)
@@ -9422,10 +9424,10 @@  joust (struct z_candidate *cand1, struct z_candida
 				     "default argument mismatch in "
 				     "overload resolution"))
 			{
-			  inform (input_location,
-				  " candidate 1: %q+#F", cand1->fn);
-			  inform (input_location,
-				  " candidate 2: %q+#F", cand2->fn);
+			  inform (DECL_SOURCE_LOCATION (cand1->fn),
+				  " candidate 1: %q#F", cand1->fn);
+			  inform (DECL_SOURCE_LOCATION (cand2->fn),
+				  " candidate 2: %q#F", cand2->fn);
 			}
 		    }
 		  else
Index: decl.c
===================================================================
--- decl.c	(revision 237318)
+++ decl.c	(working copy)
@@ -914,8 +914,9 @@  wrapup_globals_for_namespace (tree name_space, voi
 	    && !DECL_ARTIFICIAL (decl)
 	    && !TREE_NO_WARNING (decl))
 	  {
-	    warning (OPT_Wunused_function,
-		     "%q+F declared %<static%> but never defined", decl);
+	    warning_at (DECL_SOURCE_LOCATION (decl),
+			OPT_Wunused_function,
+			"%qF declared %<static%> but never defined", decl);
 	    TREE_NO_WARNING (decl) = 1;
 	  }
     }
@@ -1233,18 +1234,20 @@  check_redeclaration_exception_specification (tree
       && !comp_except_specs (new_exceptions, old_exceptions, ce_normal))
     {
       const char *msg
-	= "declaration of %q+F has a different exception specifier";
+	= "declaration of %qF has a different exception specifier";
       bool complained = true;
+      location_t new_loc = DECL_SOURCE_LOCATION (new_decl);
       if (DECL_IN_SYSTEM_HEADER (old_decl))
-	complained = pedwarn (0, OPT_Wsystem_headers, msg, new_decl);
+	complained = pedwarn (new_loc, OPT_Wsystem_headers, msg, new_decl);
       else if (!flag_exceptions)
 	/* We used to silently permit mismatched eh specs with
 	   -fno-exceptions, so make them a pedwarn now.  */
-	complained = pedwarn (0, OPT_Wpedantic, msg, new_decl);
+	complained = pedwarn (new_loc, OPT_Wpedantic, msg, new_decl);
       else
-	error (msg, new_decl);
+	error_at (new_loc, msg, new_decl);
       if (complained)
-	inform (0, "from previous declaration %q+F", old_decl);
+	inform (DECL_SOURCE_LOCATION (old_decl),
+		"from previous declaration %qF", old_decl);
     }
 }