https://gcc.gnu.org/g:6888a4bb584ad3977cb1e8cdefedea70b1f135ea

commit r15-8028-g6888a4bb584ad3977cb1e8cdefedea70b1f135ea
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Wed Mar 5 18:28:53 2025 +0100

    Move 'find-dg-do-what' from 'gcc/testsuite/lib/gcc-dg.exp' into 
'gcc/testsuite/lib/target-supports-dg.exp'
    
    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.

Diff:
---
 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 008b8538e46c..f5ad4247a619 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 c307258db836..422ea8380845 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 } {

Reply via email to