From: Jakub Jelinek Date: Fri, 23 Sep 2016 09:23:52 +0000 (+0200) Subject: gcc-dg.exp (process-message): Support relative line number notation - .+4 or .-1... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b437ebca65d92d0fc236dd0ceaff3d8f6fcc26d8;p=gcc.git 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 --- diff --git a/gcc/testsuite/gcc.dg/dg-test-1.c b/gcc/testsuite/gcc.dg/dg-test-1.c new file mode 100644 index 00000000000..ad67b2412f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dg-test-1.c @@ -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 } */ +}