From 347cce092ebd954d91046804c1d2b51b24eef68b Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 22 Sep 2021 12:42:41 +0200
Subject: [PATCH] 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.
---
gcc/testsuite/lib/gcc-dg.exp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
@@ -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
--
2.33.0