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
This commit is contained in:
David Malcolm 2017-01-03 16:25:31 +00:00 committed by David Malcolm
parent 4b1ea1f3a5
commit 8b66e61133
3 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2017-01-03 David Malcolm <dmalcolm@redhat.com>
* 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 <jakub@redhat.com>
PR tree-optimization/78965

View File

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

View File

@ -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]
}