[gcc r12-5766] Make sure that we get unique test names if several DejaGnu directives refer to the same line [PR1027

Thomas Schwinge tschwinge@gcc.gnu.org
Fri Dec 3 08:27:06 GMT 2021


https://gcc.gnu.org/g:31c200c6e110ced8732332376e69c0958985b926

commit r12-5766-g31c200c6e110ced8732332376e69c0958985b926
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Sep 22 12:42:41 2021 +0200

    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:
---
 gcc/testsuite/lib/gcc-dg.exp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 7edd070d71d..78a6c3651ef 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


More information about the Gcc-cvs mailing list