]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc-dg.exp (process-message): Support relative line number notation - .+4 or .-1...
authorJakub Jelinek <jakub@redhat.com>
Fri, 23 Sep 2016 07:46:15 +0000 (09:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 23 Sep 2016 07:46:15 +0000 (09:46 +0200)
* 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: r240391

gcc/testsuite/ChangeLog
gcc/testsuite/lib/gcc-dg.exp

index 75e7b3e075dc571bcfc2a677f3904b5a8551f38d..facc0d0a4d7bb82ac641cf5e281ea514635e7934 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-23  Jakub Jelinek  <jakub@redhat.com>
+
+       * lib/gcc-dg.exp (process-message): Support relative line number
+       notation - .+4 or .-1 etc.
+       * gcc.dg/dg-test-1.c: New test.
+
 2016-09-22  Martin Sebor  <msebor@redhat.com>
 
        PR target/77676
index b7f0ff7838a99b183249535a383dcc795f741d31..9c2e041ba35995f4182e3ab2963a569a02bfd005 100644 (file)
@@ -986,6 +986,13 @@ if { [info procs saved-dg-error] == [list] \
 proc process-message { msgproc msgprefix dgargs } {
     upvar dg-messages dg-messages
 
+    # Handle relative line specification, .+1 or .-1 etc.
+    if { [llength $dgargs] == 5
+        && [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]
+    }
+
     # Process the dg- directive, including adding the regular expression
     # to the new message entry in dg-messages.
     set msgcnt [llength ${dg-messages}]