]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move 'find-dg-do-what' from 'gcc/testsuite/lib/gcc-dg.exp' into 'gcc/testsuite/lib...
authorThomas Schwinge <tschwinge@baylibre.com>
Wed, 5 Mar 2025 17:28:53 +0000 (18:28 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Thu, 13 Mar 2025 12:07:27 +0000 (13:07 +0100)
This was added in commit f553b1aaa2b1b925c918e5dcf966290b045321c2
"Refactor duplicated code into 'gcc/testsuite/lib/gcc-dg.exp:find-dg-do-what'",
for use by 'gcc/testsuite/lib/target-supports.exp'.  The latter is used by
several test suites, 'gcc/testsuite/lib/gcc-dg.exp' however doesn't get loaded
for 'make check-target-libstdc++-v3', for example, and testing ERRORs out:

    ERROR: (DejaGnu) proc "find-dg-do-what" does not exist.
    The error code is TCL LOOKUP COMMAND find-dg-do-what
    The info on the error is:
    invalid command name "find-dg-do-what"
        while executing
    "::tcl_unknown find-dg-do-what"
        ("uplevel" body line 1)
        invoked from within
    "uplevel 1 ::tcl_unknown $args"

Fix this by moving 'find-dg-do-what' into the DejaGnu interfacing file
corresponding to 'gcc/testsuite/lib/target-supports.exp':
'gcc/testsuite/lib/target-supports-dg.exp' (next to other related procedures).

gcc/testsuite/
* lib/gcc-dg.exp (find-dg-do-what): Move...
* lib/target-supports-dg.exp: ... here.

gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/target-supports-dg.exp

index 008b8538e46cff8b84615db16a25c45b2c3ad794..f5ad4247a6193c1001ca3989d0cd55a65dc02e31 100644 (file)
@@ -1376,23 +1376,3 @@ proc gcc-transform-out-of-tree { args } {
 
 set additional_prunes ""
 set dg_runtest_extra_prunes ""
-
-# Find the 'dg-do-what' variable living inside DejaGnu's 'dg-test' procedure,
-# as a local variable.  We start looking at the second-outer frame: this way,
-# the caller of 'find-dg-do-what' may maintain a local 'dg-do-what' variable
-# without interfering with this search.
-proc find-dg-do-what { } {
-    set level [info level]
-    set lookup_level 2
-    while { $lookup_level <= $level } {
-       upvar $lookup_level dg-do-what dg-do-what
-       if { [info exists dg-do-what] } {
-           verbose "find-dg-do-what: found 'dg-do-what' at level $lookup_level: ${dg-do-what}" 2
-           return ${dg-do-what}
-       }
-       incr lookup_level
-    }
-    # We've not be called (indirectly) from 'dg-test'.
-    verbose "find-dg-do-what: have not found 'dg-do-what'" 2
-    return [list]
-}
index c307258db836a89c16cc4d74edabcc08b70f6695..422ea83808455d269ac4d47041a8249940581be1 100644 (file)
@@ -58,6 +58,27 @@ proc testname-for-summary { } {
     return "$testname_with_flags"
 }
 
+# Find the 'dg-do-what' variable living inside DejaGnu's 'dg-test' procedure,
+# as a local variable.  We start looking at the second-outer frame: this way,
+# the caller of 'find-dg-do-what' may maintain a local 'dg-do-what' variable
+# without interfering with this search.
+
+proc find-dg-do-what { } {
+    set level [info level]
+    set lookup_level 2
+    while { $lookup_level <= $level } {
+       upvar $lookup_level dg-do-what dg-do-what
+       if { [info exists dg-do-what] } {
+           verbose "find-dg-do-what: found 'dg-do-what' at level $lookup_level: ${dg-do-what}" 2
+           return ${dg-do-what}
+       }
+       incr lookup_level
+    }
+    # We've not be called (indirectly) from 'dg-test'.
+    verbose "find-dg-do-what: have not found 'dg-do-what'" 2
+    return [list]
+}
+
 # If this target does not support weak symbols, skip this test.
 
 proc dg-require-weak { args } {