From 8b66e61133e7699cb5346a18c9d2ccb1394bbce7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 3 Jan 2017 16:25:31 +0000 Subject: [PATCH] gcc-dg.exp: support more than one digit in relative line number notation gcc/testsuite/ChangeLog: * gcc.dg/dg-test-1.c: Add tests of relative line specifications with more than one digit. * lib/gcc-dg.exp (process-message): Support more than one digit in relative line specifications. From-SVN: r244024 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.dg/dg-test-1.c | 24 ++++++++++++++++++++++++ gcc/testsuite/lib/gcc-dg.exp | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abed28d0918..1626b1dcac9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-01-03 David Malcolm + + * gcc.dg/dg-test-1.c: Add tests of relative line specifications + with more than one digit. + * lib/gcc-dg.exp (process-message): Support more than one digit + in relative line specifications. + 2017-01-03 Jakub Jelinek PR tree-optimization/78965 diff --git a/gcc/testsuite/gcc.dg/dg-test-1.c b/gcc/testsuite/gcc.dg/dg-test-1.c index ad67b2412f6..c67f93b0656 100644 --- a/gcc/testsuite/gcc.dg/dg-test-1.c +++ b/gcc/testsuite/gcc.dg/dg-test-1.c @@ -16,3 +16,27 @@ 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 } */ } + + +/* Ensure that relative line numbers with more than one digit are supported. */ +/* { dg-warning "unused parameter 'i'" "warn5" { target *-*-* } .+10 } */ + + + + + + + + +void +baz (int i, int j) +{ +} + + + + + + + +/* { dg-warning "unused parameter 'j'" "warn6" { target *-*-* } .-10 } */ diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 9014a1d64a1..83c38cfbeb7 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -990,7 +990,7 @@ proc process-message { msgproc msgprefix dgargs } { # Handle relative line specification, .+1 or .-1 etc. if { [llength $dgargs] == 5 - && [regsub "^\.\[+-\](\[0-9\])$" [lindex $dgargs 4] "\\1" num] } { + && [regsub "^\.\[+-\](\[0-9\]+)$" [lindex $dgargs 4] "\\1" num] } { set num [expr [lindex $dgargs 0] [string index [lindex $dgargs 4] 1] $num] set dgargs [lreplace $dgargs 4 4 $num] } -- 2.30.2