Replace absolute line numbers in c-c++-common

2017-05-01  Tom de Vries  <tom@codesourcery.com>

	PR testsuite/80557
	* c-c++-common/Wshift-negative-value-1.c: Replace absolute line numbers.
	* c-c++-common/Wshift-negative-value-2.c: Same.
	* c-c++-common/Wshift-negative-value-3.c: Same.
	* c-c++-common/Wshift-negative-value-4.c: Same.
	* c-c++-common/cilk-plus/AN/pr57541.c: Same.
	* c-c++-common/cpp/pr60400.c: Same.
	* c-c++-common/fmax-errors.c: Same.
	* c-c++-common/goacc/data-2.c: Same.
	* c-c++-common/goacc/host_data-2.c: Same.
	* c-c++-common/gomp/simd4.c: Same.
	* c-c++-common/pr28656.c: Same.
	* c-c++-common/pr43395.c: Same.
	* c-c++-common/torture/pr57945.c: Same.

---
 gcc/testsuite/c-c++-common/Wshift-negative-value-1.c |  3 +--
 gcc/testsuite/c-c++-common/Wshift-negative-value-2.c |  5 ++---
 gcc/testsuite/c-c++-common/Wshift-negative-value-3.c |  5 ++---
 gcc/testsuite/c-c++-common/Wshift-negative-value-4.c |  5 ++---
 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c    |  2 +-
 gcc/testsuite/c-c++-common/cpp/pr60400.c             |  8 ++++----
 gcc/testsuite/c-c++-common/fmax-errors.c             |  2 +-
 gcc/testsuite/c-c++-common/goacc/data-2.c            |  2 +-
 gcc/testsuite/c-c++-common/goacc/host_data-2.c       |  8 ++++----
 gcc/testsuite/c-c++-common/gomp/simd4.c              |  4 ++--
 gcc/testsuite/c-c++-common/pr28656.c                 | 14 +++++++-------
 gcc/testsuite/c-c++-common/pr43395.c                 | 12 ++++++------
 gcc/testsuite/c-c++-common/torture/pr57945.c         |  3 +--
 13 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c
index 8f14034..7df1804 100644
--- a/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c
+++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-1.c
@@ -7,6 +7,7 @@ enum E {
   A = 0 << 1,
   B = 1 << 1,
   C = -1 << 1, /* { dg-warning "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,
   F = -1 >> 1
@@ -47,5 +48,3 @@ right (int x)
   r += -1U >> x;
   return r;
 }
-
-/* { dg-error "left operand of shift expression" "shift" { target c++ } 9 } */
diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c
index 55523a5..3a60ed7 100644
--- a/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c
+++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-2.c
@@ -7,6 +7,8 @@ enum E {
   A = 0 << 1,
   B = 1 << 1,
   C = -1 << 1, /* { dg-warning "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,
   E = 1 >> 1,
   F = -1 >> 1
@@ -47,6 +49,3 @@ right (int x)
   r += -1U >> x;
   return r;
 }
-
-/* { dg-error "not an integer constant" "no constant" { target c++ } 9 } */
-/* { dg-error "left operand of shift expression" "shift" { target c++ } 9 } */
diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-3.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-3.c
index 1295b72..503ca61 100644
--- a/gcc/testsuite/c-c++-common/Wshift-negative-value-3.c
+++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-3.c
@@ -7,6 +7,8 @@ enum E {
   A = 0 << 1,
   B = 1 << 1,
   C = -1 << 1,
+  /* { 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,
   E = 1 >> 1,
   F = -1 >> 1
@@ -47,6 +49,3 @@ right (int x)
   r += -1U >> x;
   return r;
 }
-
-/* { dg-error "not an integer constant" "no constant" { target c++ } 9 } */
-/* { dg-error "left operand of shift expression" "shift" { target c++ } 9 } */
diff --git a/gcc/testsuite/c-c++-common/Wshift-negative-value-4.c b/gcc/testsuite/c-c++-common/Wshift-negative-value-4.c
index 3088220..fa7cb4e 100644
--- a/gcc/testsuite/c-c++-common/Wshift-negative-value-4.c
+++ b/gcc/testsuite/c-c++-common/Wshift-negative-value-4.c
@@ -7,6 +7,8 @@ enum E {
   A = 0 << 1,
   B = 1 << 1,
   C = -1 << 1,
+  /* { 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,
   E = 1 >> 1,
   F = -1 >> 1
@@ -47,6 +49,3 @@ right (int x)
   r += -1U >> x;
   return r;
 }
-
-/* { dg-error "not an integer constant" "no constant" { target c++ } 9 } */
-/* { dg-error "left operand of shift expression" "shift" { target c++ } 9 } */
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
index f379e46..a956d0e 100755
--- a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
@@ -9,6 +9,7 @@ int foo () {
   /* C compiler uses the term "undeclared" whereas C++ compiler uses
     "not declared".  Thus, grepping for declared seem to be the easiest.  */
   char c = (char)N; /* { dg-error "declared" } */
+  /* { dg-message "note: each" "defined" { target c } .-1 } */
   short s = (short)N;
   long l = (long)N;
   A[l:s:c];
@@ -22,5 +23,4 @@ int foo1 (int N) {
 }
 
 
-/* { dg-message "note: each" "defined" { target c }  11 } */
 
diff --git a/gcc/testsuite/c-c++-common/cpp/pr60400.c b/gcc/testsuite/c-c++-common/cpp/pr60400.c
index fc3e0d9..59e8aec 100644
--- a/gcc/testsuite/c-c++-common/cpp/pr60400.c
+++ b/gcc/testsuite/c-c++-common/cpp/pr60400.c
@@ -2,12 +2,12 @@
 /* { dg-do compile } */
 /* { dg-options "-trigraphs -Wtrigraphs" } */
 
-??=include "pr60400-1.h"
-??=include "pr60400-2.h"
+??=include "pr60400-1.h" /* { dg-warning "trigraph" } */
+??=include "pr60400-2.h" /* { dg-warning "trigraph" } */
 
+/* These are line numbers in pr60400-{1,2}.h  Keep them absolute.  */
 /* { dg-warning "trigraph" "" { target *-*-* } 1 } */
 /* { dg-warning "trigraph" "" { target *-*-* } 2 } */
 /* { dg-warning "trigraph" "" { target *-*-* } 3 } */
 /* { dg-warning "trigraph" "" { target *-*-* } 4 } */
-/* { dg-warning "trigraph" "" { target *-*-* } 5 } */
-/* { dg-warning "trigraph" "" { target *-*-* } 6 } */
+
diff --git a/gcc/testsuite/c-c++-common/fmax-errors.c b/gcc/testsuite/c-c++-common/fmax-errors.c
index b44e238..947d600 100644
--- a/gcc/testsuite/c-c++-common/fmax-errors.c
+++ b/gcc/testsuite/c-c++-common/fmax-errors.c
@@ -11,7 +11,7 @@ void foo (unsigned int i, unsigned int j)
 
   (k) ();			/* { dg-error "" } */
   /* Make sure we see the notes related to the final error we emit.  */
-  /* { dg-message "identifier" "" { target c } 12 } */
+  /* { dg-message "identifier" "" { target c } .-2 } */
 
   /* Warnings after the final error should not appear.  */
   i + j; /* no warning.  */
diff --git a/gcc/testsuite/c-c++-common/goacc/data-2.c b/gcc/testsuite/c-c++-common/goacc/data-2.c
index 1043bf8a..a8723b0 100644
--- a/gcc/testsuite/c-c++-common/goacc/data-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/data-2.c
@@ -6,6 +6,7 @@ foo (void)
 #pragma acc enter data copyin (a, b) async wait
 #pragma acc enter data create (b[20:30]) async wait
 #pragma acc enter data (a) /* { dg-error "expected '#pragma acc' clause before '\\\(' token" } */
+/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
 #pragma acc enter data create (b(1:10)) /* { dg-error "expected '\\\)' before '\\\(' token" } */
 #pragma acc exit data delete (a) if (0)
 #pragma acc exit data copyout (b) if (a)
@@ -20,4 +21,3 @@ foo (void)
 #pragma acc enter data2 /* { dg-error "expected 'data' after" } */
 }
 
-/* { dg-error "has no data movement clause" "" { target *-*-* } 8 } */
diff --git a/gcc/testsuite/c-c++-common/goacc/host_data-2.c b/gcc/testsuite/c-c++-common/goacc/host_data-2.c
index 6337465..b3093e5 100644
--- a/gcc/testsuite/c-c++-common/goacc/host_data-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/host_data-2.c
@@ -12,14 +12,14 @@ f (void)
   ;
 
 #pragma acc host_data use_device(v2)
+  /* { dg-error ".use_device_ptr. variable is neither a pointer nor an array" "" { target c } .-1 } */
+  /* { dg-error ".use_device_ptr. variable is neither a pointer, nor an array nor reference to pointer or array" "" { target c++ } .-2 } */
   ;
-  /* { dg-error ".use_device_ptr. variable is neither a pointer nor an array" "" { target c } 14 } */
-  /* { dg-error ".use_device_ptr. variable is neither a pointer, nor an array nor reference to pointer or array" "" { target c++ } 14 } */
   
 #pragma acc host_data use_device(v0)
+  /* { dg-error ".use_device_ptr. variable is neither a pointer nor an array" "" { target c } .-1 } */
+  /* { dg-error ".use_device_ptr. variable is neither a pointer, nor an array nor reference to pointer or array" "" { target c++ } .-2 } */
   ;
-  /* { dg-error ".use_device_ptr. variable is neither a pointer nor an array" "" { target c } 19 } */
-  /* { dg-error ".use_device_ptr. variable is neither a pointer, nor an array nor reference to pointer or array" "" { target c++ } 19 } */
 }
 
 
diff --git a/gcc/testsuite/c-c++-common/gomp/simd4.c b/gcc/testsuite/c-c++-common/gomp/simd4.c
index 3990033..8c4a031 100644
--- a/gcc/testsuite/c-c++-common/gomp/simd4.c
+++ b/gcc/testsuite/c-c++-common/gomp/simd4.c
@@ -10,6 +10,8 @@ void
 foo (void)
 {
 #pragma omp simd linear(p) linear(f : 1)
+  /* { dg-error "linear clause applied to" "" { target *-*-* } .-1 } */
+  /* { dg-error "(incomplete|undefined) type" "" { target *-*-* } .-2 } */
   for (int i = 0; i < 10; i++)
     ;
 #pragma omp simd linear(j : 7.0)	/* { dg-error "step expression must be integral" } */
@@ -17,5 +19,3 @@ foo (void)
     ;
 }
 
-/* { dg-error "linear clause applied to" "" { target *-*-* } 12 } */
-/* { dg-error "(incomplete|undefined) type" "" { target *-*-* } 12 } */
diff --git a/gcc/testsuite/c-c++-common/pr28656.c b/gcc/testsuite/c-c++-common/pr28656.c
index a0c2339..903d7e5 100644
--- a/gcc/testsuite/c-c++-common/pr28656.c
+++ b/gcc/testsuite/c-c++-common/pr28656.c
@@ -18,12 +18,12 @@ void
 foo (void)
 {
   memcpy (0, 0, 0);
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } .-1 } */
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 2" "" { target *-*-* } .-2 } */
+
   bar (0, 0, 0, 0, 0);
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } .-1 } */
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 3" "" { target *-*-* } .-2 } */
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 4" "" { target *-*-* } .-3 } */
+  /* { dg-warning "null argument where non-null required\[^\n\r\]*argument 5" "" { target *-*-* } .-4 } */
 }
-
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } 20 } */
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 2" "" { target *-*-* } 20 } */
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } 21 } */
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 3" "" { target *-*-* } 21 } */
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 4" "" { target *-*-* } 21 } */
-/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 5" "" { target *-*-* } 21 } */
diff --git a/gcc/testsuite/c-c++-common/pr43395.c b/gcc/testsuite/c-c++-common/pr43395.c
index 2c30634..f672c8c 100644
--- a/gcc/testsuite/c-c++-common/pr43395.c
+++ b/gcc/testsuite/c-c++-common/pr43395.c
@@ -4,27 +4,27 @@
 void *
 foo (void)
 {
-lab:
+ lab: /* { dg-line foo_lab } */
   return &&lab;
 /* { dg-warning "function returns address of label" "" { target c } .-1 } */
-/* { dg-warning "address of label" "" { target c++ } 7 } */
+/* { dg-warning "address of label" "" { target c++ } foo_lab } */
 }
 
 void *
 bar (void)
 {
   __label__ lab;
-lab:
+ lab: /* { dg-line bar_lab } */
   return &&lab;
 /* { dg-warning "function returns address of label" "" { target c } .-1 } */
-/* { dg-warning "address of label" "" { target c++ } 17 } */
+/* { dg-warning "address of label" "" { target c++ } bar_lab } */
 }
 
 void *
 baz (void)
 {
-  int i;
+  int i; /* { dg-line baz_i } */
   return &i;
 /* { dg-warning "function returns address of local variable" "" { target c } .-1 } */
-/* { dg-warning "address of local variable" "" { target c++ } 26 } */
+/* { dg-warning "address of local variable" "" { target c++ } baz_i } */
 }
diff --git a/gcc/testsuite/c-c++-common/torture/pr57945.c b/gcc/testsuite/c-c++-common/torture/pr57945.c
index 5a5977f..2678779 100644
--- a/gcc/testsuite/c-c++-common/torture/pr57945.c
+++ b/gcc/testsuite/c-c++-common/torture/pr57945.c
@@ -3,11 +3,10 @@
 
 extern int j;
 static int i __attribute__((weakref("j")));
+/* { dg-error "PTX does not support weak declarations" "" { target nvptx-*-* } .-1 } */
 
 int
 foo (void)
 {
   return &i ? i : 0;
 }
-
-/* { dg-error "PTX does not support weak declarations" "" { target nvptx-*-* } 5 } */
