https://gcc.gnu.org/g:5f822bfc411f4c9d1b2d104e88377d263c128d37
commit 5f822bfc411f4c9d1b2d104e88377d263c128d37 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. (cherry picked from commit 6888a4bb584ad3977cb1e8cdefedea70b1f135ea) Diff: --- gcc/testsuite/ChangeLog.omp | 8 ++++++++ gcc/testsuite/lib/gcc-dg.exp | 20 -------------------- gcc/testsuite/lib/target-supports-dg.exp | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 544aa524caa5..e0ce0fd93be2 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,11 @@ +2025-03-19 Thomas Schwinge <tschwi...@baylibre.com> + + Backported from trunk: + 2025-03-13 Thomas Schwinge <tschwi...@baylibre.com> + + * lib/gcc-dg.exp (find-dg-do-what): Move... + * lib/target-supports-dg.exp: ... here. + 2025-02-28 Thomas Schwinge <tschwi...@baylibre.com> Backported from trunk: diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 34394237d13f..e61bd089fba9 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1458,23 +1458,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 6dce9fdc1ce2..e7e116df5126 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 } {