Replace absolute line numbers in g++.dg/warn

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

	PR testsuite/80557
	* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Replace absolute
	line numbers.
	* g++.dg/warn/miss-format-1.C: Same.
	* g++.dg/warn/overflow-warn-1.C: Same.
	* g++.dg/warn/overflow-warn-3.C: Same.
	* g++.dg/warn/overflow-warn-4.C: Same.

---
 .../warn/Wstrict-aliasing-float-ref-int-obj.C      |  6 ++---
 gcc/testsuite/g++.dg/warn/miss-format-1.C          |  4 +--
 gcc/testsuite/g++.dg/warn/overflow-warn-1.C        | 29 +++++++++++++---------
 gcc/testsuite/g++.dg/warn/overflow-warn-3.C        | 24 ++++++++++--------
 gcc/testsuite/g++.dg/warn/overflow-warn-4.C        | 22 +++++++++-------
 5 files changed, 49 insertions(+), 36 deletions(-)

diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C
index d298555..9bc80c3 100644
--- a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C
+++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C
@@ -4,9 +4,9 @@
 
 int foo() {
   int x;
-  float& q = reinterpret_cast<float&> (x);  /* { dg-message "dereferencing type-punned" "deref" } */
+  float& q = reinterpret_cast<float&> (x); /* { dg-message "dereferencing type-punned" "deref" } */
+  /* { dg-message "initialized" "note" { xfail *-*-* } .-1 } */
+  
   q = 1.0; /* { dg-warning "does break strict-aliasing" "strict-aliasing" { xfail *-*-* } } */
   return x;
 }
-
-/* { dg-message "initialized" "note" { xfail *-*-* } 7 } */
diff --git a/gcc/testsuite/g++.dg/warn/miss-format-1.C b/gcc/testsuite/g++.dg/warn/miss-format-1.C
index 0b3f6e9..65a3428 100644
--- a/gcc/testsuite/g++.dg/warn/miss-format-1.C
+++ b/gcc/testsuite/g++.dg/warn/miss-format-1.C
@@ -3,8 +3,6 @@
 /* { dg-do compile } */
 /* { dg-options "-Wmissing-format-attribute" } */
 /* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
-/* VxWorks does not provide vscanf, either in kernel or RTP mode.  */
-/* { dg-error "not declared" "" { target *-*-vxworks* } 26 } */
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -24,6 +22,8 @@ bar (const char *fmt, ...)
   va_list ap;
   va_start (ap, fmt);
   vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-vxworks* } } */
+  /* VxWorks does not provide vscanf, either in kernel or RTP mode.  */
+  /* { dg-error "not declared" "" { target *-*-vxworks* } .-2 } */
   va_end (ap);
 }
 
diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C
index c327cc0..314e351 100644
--- a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C
+++ b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C
@@ -18,6 +18,7 @@ enum e {
      whole expression violates the constraints.  */
   E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
   /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
+  /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
   E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
   /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
   /* Again, overflow in evaluated subexpression.  */
@@ -30,6 +31,9 @@ enum e {
 struct s {
   int a;
   int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
+/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */
+/* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */
+/* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */
   int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
   /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
 };
@@ -53,16 +57,25 @@ void *n = 0;
    subexpression, so is a null pointer constant.  */
 void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
 /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
-void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-1 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */
+
+void *q = 0 * (1 / 0);
+/* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
+/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-2 } */
+/* { dg-warning "invalid conversion from" "convert" { target *-*-* } .-3 } */
+
+void *r = (1 ? 0 : INT_MAX+1);
+/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
+/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */
 
 void
 g (int i)
 {
   switch (i)
     {
-    case 0 * (1/0): /* { dg-warning "division by zero" } */
+    case 0 * (1/0):
+      /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
+      /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */
+      /* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */
       ;
     case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
       /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
@@ -126,11 +139,3 @@ h2i (int x)
   ui = INT_MIN;
   ui = x ? INT_MIN : 1U;
 }
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
-/* { dg-warning "invalid conversion from" "convert" { target *-*-* } 56 } */
-/* { dg-warning "invalid conversion from" "convert" { target c++11 } 58 } */
-/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 65 } */
-/* { dg-error "is not a constant expression" "const" { target *-*-* } 65 } */
-/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
-/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */
diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C
index ff6864d..b319660 100644
--- a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C
+++ b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C
@@ -18,6 +18,7 @@ enum e {
      whole expression violates the constraints.  */
   E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
   /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
+  /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
   E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
   /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
   /* Again, overflow in evaluated subexpression.  */
@@ -29,7 +30,11 @@ enum e {
 
 struct s {
   int a;
-  int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
+  int : 0 * (1 / 0);
+  /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
+  /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
+  /* { dg-error "width not an integer constant" "bit.field" { target c++ } .-3 } */
+  /* { dg-error "is not a constant expression" "division" { target c++ } .-4 } */
   int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
   /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
 };
@@ -57,15 +62,20 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" }
 
 void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
 /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */
+void *r = (1 ? 0 : INT_MAX+1);
+/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
+/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */
 
 void
 g (int i)
 {
   switch (i)
     {
-    case 0 * (1/0): /* { dg-warning "division by zero" } */
-      ;  /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 }  */
+    case 0 * (1/0):
+      /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
+      /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 }  */
+      /* { dg-error "not a constant expression" "constant" { target *-*-* } .-3 } */
+      ;
     case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
       /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
       ;
@@ -128,9 +138,3 @@ h2i (int x)
   ui = INT_MIN;
   ui = x ? INT_MIN : 1U;
 }
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
-/* { dg-warning "invalid conversion from" "convert" { target c++11 } 60 } */
-/* { dg-error "not a constant expression" "constant" { target *-*-* } 67 } */
-/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
-/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */
diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C
index b9d4ebd..dfe8741 100644
--- a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C
+++ b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C
@@ -18,6 +18,7 @@ enum e {
      whole expression violates the constraints.  */
   E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
   /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
+  /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
   E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
   /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
   /* { dg-error "enumerator value for 'E5' is not an integer constant" "enum error" { target *-*-* } .-2 } */
@@ -32,6 +33,9 @@ enum e {
 struct s {
   int a;
   int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
+  /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */
+  /* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */
+  /* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */
   int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
   /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
   /* { dg-error "bit-field .* width not an integer constant" "" { target *-*-* } .-2 } */
@@ -60,15 +64,21 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" }
 
 void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
 /* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */
+
+void *r = (1 ? 0 : INT_MAX+1);
+/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
+/* { dg-error "invalid conversion from" "convert" { target c++11 } .-2 } */
 
 void
 g (int i)
 {
   switch (i)
     {
-    case 0 * (1/0): /* { dg-warning "division by zero" } */
-      ;  /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 } */
+    case 0 * (1/0):
+      /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
+      /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */
+      /* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */
+      ;
     case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
       /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
       ;
@@ -131,9 +141,3 @@ h2i (int x)
   ui = INT_MIN;
   ui = x ? INT_MIN : 1U;
 }
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
-/* { dg-error "invalid conversion from" "convert" { target c++11 } 63 } */
-/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 34 } */
-/* { dg-error "is not a constant expression" "const" { target *-*-* } 70 } */
-/* { dg-error "width not an integer constant" "bit.field" { target c++ } 34 } */
-/* { dg-error "is not a constant expression" "division" { target c++ } 34 } */
