Message ID | 1482879106-57204-1-git-send-email-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
On Dec 27, 2016, at 2:51 PM, David Malcolm <dmalcolm@redhat.com> wrote: > > In r240391 Jakub added relative line number notation (.+4 or .-1 etc) > for DejaGnu messages. > > This patch tweaks the regex to allow relative line numbers containing > more than one digit (I ran into this with a test for a diagnostic > that issues multiple notes, for which I wanted to verify the > diagnostic_show_locus output, hence I had offsets > 9). > > Successfully regression-tested (and bootstrapped) on x86_64-pc-linux-gnu; > adds 2 PASS results to gcc.sum. > > OK for trunk? Ok.
diff --git a/gcc/testsuite/gcc.dg/dg-test-1.c b/gcc/testsuite/gcc.dg/dg-test-1.c index ad67b24..c67f93b 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 6217272..a12357d 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -988,7 +988,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] }