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             | 20 --------------------
 gcc/testsuite/lib/target-supports-dg.exp | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 008b8538e46..f5ad4247a61 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -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]
-}
diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
b/gcc/testsuite/lib/target-supports-dg.exp
index c307258db83..422ea838084 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -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 } {
-- 
2.34.1

Reply via email to