From: Thomas Schwinge Date: Wed, 22 Sep 2021 10:42:41 +0000 (+0200) Subject: Make sure that we get unique test names if several DejaGnu directives refer to the... X-Git-Tag: basepoints/gcc-13~2547 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31c200c6e110ced8732332376e69c0958985b926;p=thirdparty%2Fgcc.git Make sure that we get unique test names if several DejaGnu directives refer to the same line [PR102735] gcc/testsuite/ PR testsuite/102735 * lib/gcc-dg.exp (process-message): Make sure that we get unique test names. --- diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 7edd070d71dc..78a6c3651efc 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1191,8 +1191,18 @@ proc process-message { msgproc msgprefix dgargs } { upvar dg-messages dg-messages if { [llength $dgargs] == 5 } { - set num [get-absolute-line [lindex $dgargs 0] [lindex $dgargs 4]] - set dgargs [lreplace $dgargs 4 4 $num] + set useline [lindex $dgargs 0] + + # Resolve absolute line number. + set line [get-absolute-line $useline [lindex $dgargs 4]] + set dgargs [lreplace $dgargs 4 4 $line] + + if { $line != $useline } { + # Make sure that we get unique test names if different USELINEs + # refer to the same LINE. + set comment "[lindex $dgargs 2] at line $useline" + set dgargs [lreplace $dgargs 2 2 $comment] + } } # Process the dg- directive, including adding the regular expression