diff mbox series

[C++] Fix cp_build_binary_op locations

Message ID 07497c45-5bfa-cbce-0a51-587f985bb3b5@oracle.com
State New
Headers show
Series [C++] Fix cp_build_binary_op locations | expand

Commit Message

Paolo Carlini Oct. 9, 2019, 2:23 p.m. UTC
Hi,

this largely mechanical patch fixes those errors in cp_build_binary_op 
which weren't exploiting yet the op_location_t argument, thus aligning 
the locations to those of the C front-end. Plus an additional use for 
DECL_SOURCE_LOCATION in decl.c. Tested x86_64-linux.

Thanks, Paolo.

///////////////////////////////
/cp
2019-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
	* typeck.c (cp_build_binary_op): Use the op_location_t argument
	in many error messages.

/testsuite
2019-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* c-c++-common/Waddress-1.c: Test locations too.
	* c-c++-common/Wpointer-compare-1.c: Likewise.
	* c-c++-common/Wshift-count-negative-1.c: Likewise.
	* c-c++-common/Wshift-count-overflow-1.c: Likewise.
	* c-c++-common/Wshift-negative-value-1.c: Likewise.
	* c-c++-common/Wshift-negative-value-2.c: Likewise.
	* c-c++-common/Wshift-negative-value-5.c: Likewise.
	* c-c++-common/pr48418.c: Likewise.
	* c-c++-common/pr65830.c: Likewise.
	* c-c++-common/pr69764.c: Likewise.
	* g++.dg/cpp0x/constexpr-array-ptr10.C: Likewise.
	* g++.dg/cpp0x/nullptr37.C: Likewise.
	* g++.dg/template/crash126.C: Likewise.
	* g++.dg/template/crash129.C: Likewise.
	* g++.dg/warn/Wextra-3.C: Likewise.
	* g++.dg/warn/Wfloat-equal-1.C: Likewise.
	* g++.dg/warn/Wstring-literal-comparison-1.C: Likewise.
	* g++.dg/warn/Wstring-literal-comparison-2.C: Likewise.
	* g++.dg/warn/pointer-integer-comparison.C: Likewise.
	* g++.old-deja/g++.jason/crash8.C: Likewise.

Comments

Jason Merrill Oct. 9, 2019, 3:31 p.m. UTC | #1
On 10/9/19 10:23 AM, Paolo Carlini wrote:
> Hi,
> 
> this largely mechanical patch fixes those errors in cp_build_binary_op 
> which weren't exploiting yet the op_location_t argument, thus aligning 
> the locations to those of the C front-end. Plus an additional use for 
> DECL_SOURCE_LOCATION in decl.c. Tested x86_64-linux.
> 
> Thanks, Paolo.
> 
> ///////////////////////////////
> 
OK.

Jason
diff mbox series

Patch

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 276756)
+++ cp/decl.c	(working copy)
@@ -13738,7 +13738,8 @@  grok_ctor_properties (const_tree ctype, const_tree
 	 or implicitly defined), there's no need to worry about their
 	 existence.  Theoretically, they should never even be
 	 instantiated, but that's hard to forestall.  */
-      error ("invalid constructor; you probably meant %<%T (const %T&)%>",
+      error_at (DECL_SOURCE_LOCATION (decl),
+		"invalid constructor; you probably meant %<%T (const %T&)%>",
 		ctype, ctype);
       return false;
     }
Index: cp/typeck.c
===================================================================
--- cp/typeck.c	(revision 276756)
+++ cp/typeck.c	(working copy)
@@ -4475,7 +4475,8 @@  cp_build_binary_op (const op_location_t &location,
       if (t != error_mark_node)
 	{
 	  if (complain & tf_error)
-	    permerror (input_location, "assuming cast to type %qT from overloaded function",
+	    permerror (location,
+		       "assuming cast to type %qT from overloaded function",
 		       TREE_TYPE (t));
 	  op0 = t;
 	}
@@ -4486,7 +4487,8 @@  cp_build_binary_op (const op_location_t &location,
       if (t != error_mark_node)
 	{
 	  if (complain & tf_error)
-	    permerror (input_location, "assuming cast to type %qT from overloaded function",
+	    permerror (location,
+		       "assuming cast to type %qT from overloaded function",
 		       TREE_TYPE (t));
 	  op1 = t;
 	}
@@ -4809,8 +4811,8 @@  cp_build_binary_op (const op_location_t &location,
 		{
 		  if ((complain & tf_warning)
 		      && c_inhibit_evaluation_warnings == 0)
-		    warning (OPT_Wshift_count_negative,
-			     "right shift count is negative");
+		    warning_at (location, OPT_Wshift_count_negative,
+				"right shift count is negative");
 		}
 	      else
 		{
@@ -4817,8 +4819,8 @@  cp_build_binary_op (const op_location_t &location,
 		  if (compare_tree_int (const_op1, TYPE_PRECISION (type0)) >= 0
 		      && (complain & tf_warning)
 		      && c_inhibit_evaluation_warnings == 0)
-		    warning (OPT_Wshift_count_overflow,
-			     "right shift count >= width of type");
+		    warning_at (location, OPT_Wshift_count_overflow,
+				"right shift count >= width of type");
 		}
 	    }
 	  /* Avoid converting op1 to result_type later.  */
@@ -4856,8 +4858,8 @@  cp_build_binary_op (const op_location_t &location,
 	      && tree_int_cst_sgn (const_op0) < 0
 	      && (complain & tf_warning)
 	      && c_inhibit_evaluation_warnings == 0)
-	    warning (OPT_Wshift_negative_value,
-		     "left shift of negative value");
+	    warning_at (location, OPT_Wshift_negative_value,
+			"left shift of negative value");
 	  if (TREE_CODE (const_op1) == INTEGER_CST)
 	    {
 	      if (tree_int_cst_lt (const_op1, integer_zero_node))
@@ -4864,8 +4866,8 @@  cp_build_binary_op (const op_location_t &location,
 		{
 		  if ((complain & tf_warning)
 		      && c_inhibit_evaluation_warnings == 0)
-		    warning (OPT_Wshift_count_negative,
-			     "left shift count is negative");
+		    warning_at (location, OPT_Wshift_count_negative,
+				"left shift count is negative");
 		}
 	      else if (compare_tree_int (const_op1,
 					 TYPE_PRECISION (type0)) >= 0)
@@ -4872,8 +4874,8 @@  cp_build_binary_op (const op_location_t &location,
 		{
 		  if ((complain & tf_warning)
 		      && c_inhibit_evaluation_warnings == 0)
-		    warning (OPT_Wshift_count_overflow,
-			     "left shift count >= width of type");
+		    warning_at (location, OPT_Wshift_count_overflow,
+				"left shift count >= width of type");
 		}
 	      else if (TREE_CODE (const_op0) == INTEGER_CST
 		       && (complain & tf_warning))
@@ -4920,8 +4922,9 @@  cp_build_binary_op (const op_location_t &location,
       if ((complain & tf_warning)
 	  && c_inhibit_evaluation_warnings == 0
 	  && (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1)))
-	warning (OPT_Wfloat_equal,
-		 "comparing floating-point with %<==%> or %<!=%> is unsafe");
+	warning_at (location, OPT_Wfloat_equal,
+		    "comparing floating-point with %<==%> "
+		    "or %<!=%> is unsafe");
       if (complain & tf_warning)
 	{
 	  tree stripped_orig_op0 = tree_strip_any_location_wrapper (orig_op0);
@@ -4930,8 +4933,9 @@  cp_build_binary_op (const op_location_t &location,
 	       && !integer_zerop (cp_fully_fold (op1)))
 	      || (TREE_CODE (stripped_orig_op1) == STRING_CST
 		  && !integer_zerop (cp_fully_fold (op0))))
-	    warning (OPT_Waddress, "comparison with string literal results "
-		     "in unspecified behavior");
+	    warning_at (location, OPT_Waddress,
+			"comparison with string literal results in "
+			"unspecified behavior");
 	}
 
       build_type = boolean_type_node;
@@ -4955,11 +4959,11 @@  cp_build_binary_op (const op_location_t &location,
 	  if (char_type_p (TREE_TYPE (orig_op1)))
 	    {
 	      auto_diagnostic_group d;
-	      if (warning (OPT_Wpointer_compare,
-			     "comparison between pointer and zero character "
-			     "constant"))
-		inform (input_location,
-			  "did you mean to dereference the pointer?");
+	      if (warning_at (location, OPT_Wpointer_compare,
+			      "comparison between pointer and zero character "
+			      "constant"))
+		inform (location,
+			"did you mean to dereference the pointer?");
 	    }
 	  warn_for_null_address (location, op0, complain);
 	}
@@ -4978,10 +4982,10 @@  cp_build_binary_op (const op_location_t &location,
 	  if (char_type_p (TREE_TYPE (orig_op0)))
 	    {
 	      auto_diagnostic_group d;
-	      if (warning (OPT_Wpointer_compare,
+	      if (warning_at (location, OPT_Wpointer_compare,
 			     "comparison between pointer and zero character "
 			     "constant"))
-		inform (input_location,
+		inform (location,
 			"did you mean to dereference the pointer?");
 	    }
 	  warn_for_null_address (location, op1, complain);
@@ -4996,8 +5000,9 @@  cp_build_binary_op (const op_location_t &location,
       else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
 	{
 	  result_type = type0;
-	  if (complain & tf_error) 
-            permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
+	  if (complain & tf_error)
+	    permerror (location, "ISO C++ forbids comparison between "
+		       "pointer and integer");
           else
             return error_mark_node;
 	}
@@ -5005,7 +5010,8 @@  cp_build_binary_op (const op_location_t &location,
 	{
 	  result_type = type1;
 	  if (complain & tf_error)
-	    permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
+	    permerror (location, "ISO C++ forbids comparison between "
+		       "pointer and integer");
           else
             return error_mark_node;
 	}
@@ -5191,8 +5197,9 @@  cp_build_binary_op (const op_location_t &location,
 	  || TREE_CODE (orig_op1) == STRING_CST)
 	{
 	  if (complain & tf_warning)
-	    warning (OPT_Waddress, "comparison with string literal results "
-				   "in unspecified behavior");
+	    warning_at (location, OPT_Waddress,
+			"comparison with string literal results "
+			"in unspecified behavior");
 	}
 
       if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
@@ -5267,15 +5274,15 @@  cp_build_binary_op (const op_location_t &location,
 	{
 	  result_type = type0;
 	  if (extra_warnings && (complain & tf_warning))
-	    warning (OPT_Wextra,
-		     "ordered comparison of pointer with integer zero");
+	    warning_at (location, OPT_Wextra,
+			"ordered comparison of pointer with integer zero");
 	}
       else if (code1 == POINTER_TYPE && null_ptr_cst_p (orig_op0))
 	{
 	  result_type = type1;
 	  if (extra_warnings && (complain & tf_warning))
-	    warning (OPT_Wextra,
-		     "ordered comparison of pointer with integer zero");
+	    warning_at (location, OPT_Wextra,
+			"ordered comparison of pointer with integer zero");
 	}
       else if (null_ptr_cst_p (orig_op0) && null_ptr_cst_p (orig_op1))
 	/* One of the operands must be of nullptr_t type.  */
@@ -5284,8 +5291,9 @@  cp_build_binary_op (const op_location_t &location,
 	{
 	  result_type = type0;
 	  if (complain & tf_error)
-	    permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
-          else
+	    permerror (location, "ISO C++ forbids comparison between "
+		       "pointer and integer");
+	  else
             return error_mark_node;
 	}
       else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
@@ -5292,8 +5300,9 @@  cp_build_binary_op (const op_location_t &location,
 	{
 	  result_type = type1;
 	  if (complain & tf_error)
-	    permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
-          else
+	    permerror (location, "ISO C++ forbids comparison between "
+		       "pointer and integer");
+	  else
             return error_mark_node;
 	}
 
Index: testsuite/c-c++-common/Waddress-1.c
===================================================================
--- testsuite/c-c++-common/Waddress-1.c	(revision 276756)
+++ testsuite/c-c++-common/Waddress-1.c	(working copy)
@@ -8,8 +8,8 @@  int
 foo ()
 {
   return "foo1" != (void *) 0	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
-	 && "foo2" != (const char *) ((void *) 0)	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
-	 && "foo3" != (const char *) ((void *) (10 - 10))	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
-	 && "foo4" != (const char *) ((void *) (&e - &e))	/* { dg-warning "comparison with string literal results in unspecified behavior" "" { target c } } */
-	 && "foo5" != "foo6";	/* { dg-warning "comparison with string literal results in unspecified behavior" } */
+    && "foo2" != (const char *) ((void *) 0)	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
+    && "foo3" != (const char *) ((void *) (10 - 10))	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
+    && "foo4" != (const char *) ((void *) (&e - &e))	/* { dg-warning "15:comparison with string literal results in unspecified behavior" "" { target c } } */
+    && "foo5" != "foo6";	/* { dg-warning "15:comparison with string literal results in unspecified behavior" } */
 }
Index: testsuite/c-c++-common/Wpointer-compare-1.c
===================================================================
--- testsuite/c-c++-common/Wpointer-compare-1.c	(revision 276756)
+++ testsuite/c-c++-common/Wpointer-compare-1.c	(working copy)
@@ -8,25 +8,25 @@  f1 (int *p, int **q)
 {
   int r = 0;
 
-  r += p == '\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += p == L'\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += p != '\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += p != L'\0'; /* { dg-warning "comparison between pointer and zero character" } */
+  r += p == '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += p == L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += p != '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += p != L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
 
-  r += '\0' == p; /* { dg-warning "comparison between pointer and zero character" } */
-  r += L'\0' == p; /* { dg-warning "comparison between pointer and zero character" } */
-  r += '\0' != p; /* { dg-warning "comparison between pointer and zero character" } */
-  r += L'\0' != p; /* { dg-warning "comparison between pointer and zero character" } */
+  r += '\0' == p; /* { dg-warning "13:comparison between pointer and zero character" } */
+  r += L'\0' == p; /* { dg-warning "14:comparison between pointer and zero character" } */
+  r += '\0' != p; /* { dg-warning "13:comparison between pointer and zero character" } */
+  r += L'\0' != p; /* { dg-warning "14:comparison between pointer and zero character" } */
 
-  r += q == '\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += q == L'\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += q != '\0'; /* { dg-warning "comparison between pointer and zero character" } */
-  r += q != L'\0'; /* { dg-warning "comparison between pointer and zero character" } */
+  r += q == '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += q == L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += q != '\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += q != L'\0'; /* { dg-warning "10:comparison between pointer and zero character" } */
 
-  r += '\0' == q; /* { dg-warning "comparison between pointer and zero character" } */
-  r += L'\0' == q; /* { dg-warning "comparison between pointer and zero character" } */
-  r += '\0' != q; /* { dg-warning "comparison between pointer and zero character" } */
-  r += L'\0' != q; /* { dg-warning "comparison between pointer and zero character" } */
+  r += '\0' == q; /* { dg-warning "13:comparison between pointer and zero character" } */
+  r += L'\0' == q; /* { dg-warning "14:comparison between pointer and zero character" } */
+  r += '\0' != q; /* { dg-warning "13:comparison between pointer and zero character" } */
+  r += L'\0' != q; /* { dg-warning "14:comparison between pointer and zero character" } */
 
   return r;
 }
@@ -55,11 +55,11 @@  f3 (int *p)
 {
   int r = 0;
 
-  r += p == (char) 0; /* { dg-warning "comparison between pointer and zero character" } */
-  r += p != (char) 0; /* { dg-warning "comparison between pointer and zero character" } */
+  r += p == (char) 0; /* { dg-warning "10:comparison between pointer and zero character" } */
+  r += p != (char) 0; /* { dg-warning "10:comparison between pointer and zero character" } */
 
-  r += (char) 0 == p; /* { dg-warning "comparison between pointer and zero character" } */
-  r += (char) 0 != p; /* { dg-warning "comparison between pointer and zero character" } */
+  r += (char) 0 == p; /* { dg-warning "17:comparison between pointer and zero character" } */
+  r += (char) 0 != p; /* { dg-warning "17:comparison between pointer and zero character" } */
 
   return r;
 }
Index: testsuite/c-c++-common/Wshift-count-negative-1.c
===================================================================
--- testsuite/c-c++-common/Wshift-count-negative-1.c	(revision 276756)
+++ testsuite/c-c++-common/Wshift-count-negative-1.c	(working copy)
@@ -3,6 +3,6 @@ 
 
 void foo()
 {
-  unsigned i1 = 1U << -1; /* { dg-warning "left shift count is negative" } */
-  unsigned i2 = 1U >> -1; /* { dg-warning "right shift count is negative" } */
+  unsigned i1 = 1U << -1; /* { dg-warning "20:left shift count is negative" } */
+  unsigned i2 = 1U >> -1; /* { dg-warning "20:right shift count is negative" } */
 }
Index: testsuite/c-c++-common/Wshift-count-overflow-1.c
===================================================================
--- testsuite/c-c++-common/Wshift-count-overflow-1.c	(revision 276756)
+++ testsuite/c-c++-common/Wshift-count-overflow-1.c	(working copy)
@@ -3,6 +3,6 @@ 
 
 void foo()
 {
-  unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */
-  unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */
+  unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:left shift count >= width of type" } */
+  unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "20:right shift count >= width of type" } */
 }
Index: testsuite/c-c++-common/Wshift-negative-value-1.c
===================================================================
--- testsuite/c-c++-common/Wshift-negative-value-1.c	(revision 276756)
+++ testsuite/c-c++-common/Wshift-negative-value-1.c	(working copy)
@@ -6,7 +6,7 @@ 
 enum E {
   A = 0 << 1,
   B = 1 << 1,
-  C = -1 << 1, /* { dg-warning "left shift of negative value|not an integer constant" } */
+  C = -1 << 1, /* { dg-warning "10:left shift of negative value|not an integer constant" } */
   /* { dg-error "left operand of shift expression" "shift" { target c++ } .-1 } */
   D = 0 >> 1,
   E = 1 >> 1,
@@ -23,10 +23,10 @@  left (int x)
   int r = 0;
   r += z << x;
   r += o << x;
-  r += m << x; /* { dg-warning "left shift of negative value" } */
+  r += m << x; /* { dg-warning "10:left shift of negative value" } */
   r += 0 << x;
   r += 1 << x;
-  r += -1 << x; /* { dg-warning "left shift of negative value" } */
+  r += -1 << x; /* { dg-warning "11:left shift of negative value" } */
   r += -1U << x;
   return r;
 }
Index: testsuite/c-c++-common/Wshift-negative-value-2.c
===================================================================
--- testsuite/c-c++-common/Wshift-negative-value-2.c	(revision 276756)
+++ testsuite/c-c++-common/Wshift-negative-value-2.c	(working copy)
@@ -6,7 +6,7 @@ 
 enum E {
   A = 0 << 1,
   B = 1 << 1,
-  C = -1 << 1, /* { dg-warning "left shift of negative value" } */
+  C = -1 << 1, /* { dg-warning "10:left shift of negative value" } */
   /* { dg-error "not an integer constant" "no constant" { target c++ } .-1 } */
   /* { dg-error "left operand of shift expression" "shift" { target c++ } .-2 } */
   D = 0 >> 1,
@@ -24,10 +24,10 @@  left (int x)
   int r = 0;
   r += z << x;
   r += o << x;
-  r += m << x; /* { dg-warning "left shift of negative value" } */
+  r += m << x; /* { dg-warning "10:left shift of negative value" } */
   r += 0 << x;
   r += 1 << x;
-  r += -1 << x; /* { dg-warning "left shift of negative value" } */
+  r += -1 << x; /* { dg-warning "11:left shift of negative value" } */
   r += -1U << x;
   return r;
 }
Index: testsuite/c-c++-common/Wshift-negative-value-5.c
===================================================================
--- testsuite/c-c++-common/Wshift-negative-value-5.c	(revision 276756)
+++ testsuite/c-c++-common/Wshift-negative-value-5.c	(working copy)
@@ -7,7 +7,7 @@ 
 enum E {
   A = 0 << 1,
   B = 1 << 1,
-  C = -1 << 1, /* { dg-warning "left shift of negative value" } */
+  C = -1 << 1, /* { dg-warning "10:left shift of negative value" } */
   D = 0 >> 1,
   E = 1 >> 1,
   F = -1 >> 1
@@ -23,10 +23,10 @@  left (int x)
   int r = 0;
   r += z << x;
   r += o << x;
-  r += m << x; /* { dg-warning "left shift of negative value" } */
+  r += m << x; /* { dg-warning "10:left shift of negative value" } */
   r += 0 << x;
   r += 1 << x;
-  r += -1 << x; /* { dg-warning "left shift of negative value" } */
+  r += -1 << x; /* { dg-warning "11:left shift of negative value" } */
   r += -1U << x;
   return r;
 }
Index: testsuite/c-c++-common/pr48418.c
===================================================================
--- testsuite/c-c++-common/pr48418.c	(revision 276756)
+++ testsuite/c-c++-common/pr48418.c	(working copy)
@@ -8,13 +8,13 @@  foo (int x)
   const int a = sizeof (int) * __CHAR_BIT__;
   const int b = -7;
   int c = 0;
-  c += x << a;				   /* { dg-warning "left shift count >= width of type" } */
-  c += x << b;				   /* { dg-warning "left shift count is negative" } */
-  c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */
-  c += x << -7;				   /* { dg-warning "left shift count is negative" } */
-  c += x >> a;				   /* { dg-warning "right shift count >= width of type" } */
-  c += x >> b;				   /* { dg-warning "right shift count is negative" } */
-  c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */
-  c += x >> -7;				   /* { dg-warning "right shift count is negative" } */
+  c += x << a;				   /* { dg-warning "10:left shift count >= width of type" } */
+  c += x << b;				   /* { dg-warning "10:left shift count is negative" } */
+  c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:left shift count >= width of type" } */
+  c += x << -7;				   /* { dg-warning "10:left shift count is negative" } */
+  c += x >> a;				   /* { dg-warning "10:right shift count >= width of type" } */
+  c += x >> b;				   /* { dg-warning "10:right shift count is negative" } */
+  c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "10:right shift count >= width of type" } */
+  c += x >> -7;				   /* { dg-warning "10:right shift count is negative" } */
   return c;
 }
Index: testsuite/c-c++-common/pr65830.c
===================================================================
--- testsuite/c-c++-common/pr65830.c	(revision 276756)
+++ testsuite/c-c++-common/pr65830.c	(working copy)
@@ -8,9 +8,9 @@  foo (int x)
   const int a = sizeof (int) * __CHAR_BIT__;
   const int b = -7;
   int c = 0;
-  c += x << a;	/* { dg-bogus "left shift count >= width of type" } */
-  c += x << b;	/* { dg-bogus "left shift count is negative" } */
-  c += x >> a;	/* { dg-bogus "right shift count >= width of type" } */
-  c += x >> b;  /* { dg-bogus "right shift count is negative" } */
+  c += x << a;	/* { dg-bogus "10:left shift count >= width of type" } */
+  c += x << b;	/* { dg-bogus "10:left shift count is negative" } */
+  c += x >> a;	/* { dg-bogus "10:right shift count >= width of type" } */
+  c += x >> b;  /* { dg-bogus "10:right shift count is negative" } */
   return c;
 }
Index: testsuite/c-c++-common/pr69764.c
===================================================================
--- testsuite/c-c++-common/pr69764.c	(revision 276756)
+++ testsuite/c-c++-common/pr69764.c	(working copy)
@@ -4,35 +4,35 @@ 
 unsigned char
 fn1 (unsigned char a)
 {
-  return a >> ~6;	/* { dg-warning "right shift count is negative" } */
+  return a >> ~6;	/* { dg-warning "12:right shift count is negative" } */
 }
 
 unsigned short
 fn2 (unsigned short a)
 {
-  return a >> ~6;	/* { dg-warning "right shift count is negative" } */
+  return a >> ~6;	/* { dg-warning "12:right shift count is negative" } */
 }
 
 unsigned int
 fn3 (unsigned int a)
 {
-  return a >> ~6;	/* { dg-warning "right shift count is negative" } */
+  return a >> ~6;	/* { dg-warning "12:right shift count is negative" } */
 }
 
 unsigned char
 fn4 (unsigned char a)
 {
-  return a >> 0xff03;	/* { dg-warning "right shift count >= width of type" } */
+  return a >> 0xff03;	/* { dg-warning "12:right shift count >= width of type" } */
 }
 
 unsigned short
 fn5 (unsigned short a)
 {
-  return a >> 0xff03;	/* { dg-warning "right shift count >= width of type" } */
+  return a >> 0xff03;	/* { dg-warning "12:right shift count >= width of type" } */
 }
 
 unsigned int
 fn6 (unsigned int a)
 {
-  return a >> 0xff03;	/* { dg-warning "right shift count >= width of type" } */
+  return a >> 0xff03;	/* { dg-warning "12:right shift count >= width of type" } */
 }
Index: testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C	(revision 276756)
+++ testsuite/g++.dg/cpp0x/constexpr-array-ptr10.C	(working copy)
@@ -19,18 +19,18 @@  constexpr int *p0 = &i;
 constexpr bool b0  = p0;        // { dg-warning "address of .A::i." }
 constexpr bool b1  = p0 == 0;   // { dg-warning "address of .A::i." }
 constexpr bool b2  = p0 != 0;   // { dg-warning "address of .A::i." }
-constexpr bool b3  = p0 <  0;   // { dg-warning "ordered comparison" }
-constexpr bool b4  = p0 <= 0;   // { dg-warning "ordered comparison" }
-constexpr bool b5  = p0 >  0;   // { dg-warning "ordered comparison" }
-constexpr bool b6  = p0 >= 0;   // { dg-warning "ordered comparison" }
+constexpr bool b3  = p0 <  0;   // { dg-warning "25:ordered comparison" }
+constexpr bool b4  = p0 <= 0;   // { dg-warning "25:ordered comparison" }
+constexpr bool b5  = p0 >  0;   // { dg-warning "25:ordered comparison" }
+constexpr bool b6  = p0 >= 0;   // { dg-warning "25:ordered comparison" }
 
 constexpr bool b7  = !p0;       // { dg-warning "address of .A::i." }
 constexpr bool b8  = 0 == p0;   // { dg-warning "address of .A::i." }
 constexpr bool b9  = 0 != p0;   // { dg-warning "address of .A::i." }
-constexpr bool b10 = 0 <  p0;   // { dg-warning "ordered comparison" }
-constexpr bool b11 = 0 <= p0;   // { dg-warning "ordered comparison" }
-constexpr bool b12 = 0 >  p0;   // { dg-warning "ordered comparison" }
-constexpr bool b13 = 0 >= p0;   // { dg-warning "ordered comparison" }
+constexpr bool b10 = 0 <  p0;   // { dg-warning "24:ordered comparison" }
+constexpr bool b11 = 0 <= p0;   // { dg-warning "24:ordered comparison" }
+constexpr bool b12 = 0 >  p0;   // { dg-warning "24:ordered comparison" }
+constexpr bool b13 = 0 >= p0;   // { dg-warning "24:ordered comparison" }
 
 }
 
Index: testsuite/g++.dg/cpp0x/nullptr37.C
===================================================================
--- testsuite/g++.dg/cpp0x/nullptr37.C	(revision 276756)
+++ testsuite/g++.dg/cpp0x/nullptr37.C	(working copy)
@@ -6,41 +6,41 @@  f1 (int *p, int **q)
 {
   int r = 0;
 
-  r += p == '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p == L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p == u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p == U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p != '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p != L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p != u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p != U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p == '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p == L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p == u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p == U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p != '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p != L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p != u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p != U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
-  r += '\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += L'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += u'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += U'\0' == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += '\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += L'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += u'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += U'\0' != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += '\0' == p; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += L'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += u'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += U'\0' == p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += '\0' != p; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += L'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += u'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += U'\0' != p; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
-  r += q == '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q == L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q == u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q == U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q != '\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q != L'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q != u'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += q != U'\0'; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q == '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q == L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q == u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q == U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q != '\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q != L'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q != u'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += q != U'\0'; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
-  r += '\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += L'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += u'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += U'\0' == q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += '\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += L'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += u'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += U'\0' != q; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += '\0' == q; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += L'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += u'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += U'\0' == q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += '\0' != q; // { dg-error "13:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += L'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += u'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += U'\0' != q; // { dg-error "14:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
   return r;
 }
@@ -68,11 +68,11 @@  f3 (int *p)
 {
   int r = 0;
 
-  r += p == (char) 0; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += p != (char) 0; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p == (char) 0; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += p != (char) 0; // { dg-error "10:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
-  r += (char) 0 == p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
-  r += (char) 0 != p; // { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += (char) 0 == p; // { dg-error "17:ISO C\\+\\+ forbids comparison between pointer and integer" }
+  r += (char) 0 != p; // { dg-error "17:ISO C\\+\\+ forbids comparison between pointer and integer" }
 
   return r;
 }
Index: testsuite/g++.dg/template/crash126.C
===================================================================
--- testsuite/g++.dg/template/crash126.C	(revision 276756)
+++ testsuite/g++.dg/template/crash126.C	(working copy)
@@ -4,7 +4,7 @@  template < class T, class > struct A
 {
   A ();
   A (A &);
-  A (A < T, T >);  // { dg-error "invalid constructor" }
+  A (A < T, T >);  // { dg-error "3:invalid constructor" }
 };
 
 void f () 
Index: testsuite/g++.dg/template/crash129.C
===================================================================
--- testsuite/g++.dg/template/crash129.C	(revision 276756)
+++ testsuite/g++.dg/template/crash129.C	(working copy)
@@ -1,5 +1,5 @@ 
 // PR c++/79626
 
 template <class a, class> struct b
-{ b(); b(b &); b(b< a, a >); };  // { dg-error "invalid constructor" }
+{ b(); b(b &); b(b< a, a >); };  // { dg-error "16:invalid constructor" }
 int c(b< int, int >(b< int, int >());  // { dg-error "" }
Index: testsuite/g++.dg/warn/Wextra-3.C
===================================================================
--- testsuite/g++.dg/warn/Wextra-3.C	(revision 276756)
+++ testsuite/g++.dg/warn/Wextra-3.C	(working copy)
@@ -3,7 +3,7 @@ 
 
 extern void* p;
 
-int f1() { return ( p <  0 ? 1 : 0 ); } // { dg-warning "ordered comparison" }
-int f2() { return ( p <= 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" }
-int f3() { return ( p >  0 ? 1 : 0 ); } // { dg-warning "ordered comparison" }
-int f4() { return ( p >= 0 ? 1 : 0 ); } // { dg-warning "ordered comparison" }
+int f1() { return ( p <  0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" }
+int f2() { return ( p <= 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" }
+int f3() { return ( p >  0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" }
+int f4() { return ( p >= 0 ? 1 : 0 ); } // { dg-warning "23:ordered comparison" }
Index: testsuite/g++.dg/warn/Wfloat-equal-1.C
===================================================================
--- testsuite/g++.dg/warn/Wfloat-equal-1.C	(revision 276756)
+++ testsuite/g++.dg/warn/Wfloat-equal-1.C	(working copy)
@@ -4,7 +4,7 @@ 
 
 double a, b;
 _Complex double c, d;
-int f(void) { return a == b; } /* { dg-warning "comparing floating-point" } */
-int g(void) { return c == d; } /* { dg-warning "comparing floating-point" } */
-int h(void) { return a != b; } /* { dg-warning "comparing floating-point" } */
-int i(void) { return c != d; } /* { dg-warning "comparing floating-point" } */
+int f(void) { return a == b; } /* { dg-warning "24:comparing floating-point" } */
+int g(void) { return c == d; } /* { dg-warning "24:comparing floating-point" } */
+int h(void) { return a != b; } /* { dg-warning "24:comparing floating-point" } */
+int i(void) { return c != d; } /* { dg-warning "24:comparing floating-point" } */
Index: testsuite/g++.dg/warn/Wstring-literal-comparison-1.C
===================================================================
--- testsuite/g++.dg/warn/Wstring-literal-comparison-1.C	(revision 276756)
+++ testsuite/g++.dg/warn/Wstring-literal-comparison-1.C	(working copy)
@@ -4,7 +4,7 @@ 
 
 int test1(char *ptr)
 {
-  return ptr == "foo";  /* { dg-warning "comparison with string" } */
+  return ptr == "foo";  /* { dg-warning "14:comparison with string" } */
 }
 
 int test2()
Index: testsuite/g++.dg/warn/Wstring-literal-comparison-2.C
===================================================================
--- testsuite/g++.dg/warn/Wstring-literal-comparison-2.C	(revision 276756)
+++ testsuite/g++.dg/warn/Wstring-literal-comparison-2.C	(working copy)
@@ -4,7 +4,7 @@ 
 
 int test1(char *ptr)
 {
-  return ptr == "foo";  /* { dg-warning "comparison with string" } */
+  return ptr == "foo";  /* { dg-warning "14:comparison with string" } */
 }
 
 int test2()
Index: testsuite/g++.dg/warn/pointer-integer-comparison.C
===================================================================
--- testsuite/g++.dg/warn/pointer-integer-comparison.C	(revision 276756)
+++ testsuite/g++.dg/warn/pointer-integer-comparison.C	(working copy)
@@ -3,24 +3,24 @@ 
 
 int foo (int i, void *p)
 {
-  if (i == p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  if (i == p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" }
     return 0;
-  else if (i != p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  else if (i != p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" }
     return 1;
 }
 
 int bar (int i, void *p)
 {
-  if (i < p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  if (i < p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" }
     return 0;
-  else if (i >= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  else if (i >= p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" }
     return 1;
 }
 
 int baz (int i, void *p)
 {
-  if (i <= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  if (i <= p) // { dg-warning "9:ISO C.. forbids comparison between pointer and integer" }
     return 0;
-  else if (i > p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
+  else if (i > p) // { dg-warning "14:ISO C.. forbids comparison between pointer and integer" }
     return 1;
 }
Index: testsuite/g++.old-deja/g++.jason/crash8.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/crash8.C	(revision 276756)
+++ testsuite/g++.old-deja/g++.jason/crash8.C	(working copy)
@@ -1,7 +1,7 @@ 
 // { dg-do assemble  }
 struct A {
   A();
-  A(A);				// { dg-error "" } copy ctor must take reference
+  A(A);				// { dg-error "3:invalid constructor" } copy ctor must take reference
 };
 int main()
 {