gcc-dg.exp (process-message): Support relative line number notation - .+4 or .-1 etc.

* 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
This commit is contained in:
Jakub Jelinek 2016-09-23 11:23:52 +02:00
parent b1a970a5cc
commit b437ebca65

View File

@ -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 } */
}