gcc-dg.exp (process-message): Support relative line number notation - .+4 or .-1...
authorJakub Jelinek <jakub@gcc.gnu.org>
Fri, 23 Sep 2016 09:23:52 +0000 (11:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 23 Sep 2016 09:23:52 +0000 (11:23 +0200)
* lib/gcc-dg.exp (process-message): Support relative line number
notation - .+4 or .-1 etc.
* gcc.dg/dg-test-1.c: New test.

From-SVN: r240405

gcc/testsuite/gcc.dg/dg-test-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/dg-test-1.c b/gcc/testsuite/gcc.dg/dg-test-1.c
new file mode 100644 (file)
index 0000000..ad67b24
--- /dev/null
@@ -0,0 +1,18 @@
+/* Test relative line number specification extensions over what DejaGNU supports.  */
+/* { dg-do compile } */
+/* { dg-options "-Wunused-parameter" } */
+
+void
+foo (void)
+{                      /* { dg-error "'a' undeclared" "err1" { target *-*-* } .+1 } */
+  int z = a + b + c + d;/* { dg-error "'b' undeclared" "err2" { target *-*-* } . } */
+}                      /* { dg-error "'c' undeclared" "err3" { target *-*-* } .-1 } */
+
+
+/* { dg-error "'d' undeclared" "err4" { target *-*-* } .-4 } */
+/* { dg-warning "unused parameter 'e'" "warn1" { target *-*-* } .+3 } */
+
+void                           /* { dg-warning "unused parameter 'f'" "warn2" { target *-*-* } .+1 } */
+bar (int e, int f, int g, int h)/* { dg-warning "unused parameter 'g'" "warn3" { target *-*-* } . } */
+{                              /* { dg-warning "unused parameter 'h'" "warn4" { target *-*-* } .-1 } */
+}