On Mar 29, 2023, Thomas Schwinge <tho...@codesourcery.com> wrote:

> I assume that the second UNSUPPORTED:

>     -UNSUPPORTED: g++.dg/modules/explicit-bool-1_b.C -std=c++17

> ... disappears is the intention of this patch?

Yup

> But surely the curly braces in:

>     -UNSUPPORTED: g++.dg/modules/explicit-bool-1_a.H -std=c++17

>     +UNSUPPORTED: {g++.dg/modules/explicit-bool-1_a.H -std=c++17}

> ... are not intentional?  (Alexandre?)

Unintended indeed, will look, thanks for letting me know


> But worse, the latter also "bleeds into" all other testing

Eeek

Yeah, that's a much bigger problem indeed.

> ..., this isn't sufficient.  Instead, we should undo the 'rename' at the
> end of 'g++.dg/modules/modules.exp'.  OK to push the attached
> "'g++.dg/modules/modules.exp': don't leak local 'unsupported' proc [PR108899]"
> after proper testing?

Ooh, nice, I didn't know how to drop the renaming after we were done
with it, and hoped the end of the .exp would have accomplished that by
ending a scope.  Jakub had already pointed out this wasn't the case, but
I didn't realize, when he did, that this would carry over onto other
modules.


If we're dropping the renaming, I suppose we could also revert Jakub's
change.  I suppose this patch will take care of it, pending testing...


diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
b/gcc/testsuite/g++.dg/modules/modules.exp
index 80aa392bc7f3b..6fd5050cef79b 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -319,15 +319,11 @@ cleanup_module_files [find $DEFAULT_REPO *.gcm]
 # so that, after an unsupported result in dg-test, we can skip rather
 # than fail subsequent related tests.
 set module_do {"compile" "P"}
-if { [info procs unsupported] != [list] \
-      && [info procs saved-unsupported] == [list] } {
-    rename unsupported saved-unsupported
-
-    proc unsupported { args } {
-       global module_do
-       lset module_do 1 "N"
-       return [saved-unsupported $args]
-    }
+rename unsupported modules-saved-unsupported
+proc unsupported { args } {
+    global module_do
+    lset module_do 1 "N"
+    return [eval modules-saved-unsupported $args]
 }
 
 # not grouped tests, sadly tcl doesn't have negated glob
@@ -412,4 +408,10 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
     }
 }
 
+# Restore the original unsupported proc, lest it will affect
+# subsequent test runs, or even fail renaming if we run modules.exp
+# for multiple targets/multilibs/options.
+rename unsupported {}
+rename modules-saved-unsupported unsupported
+
 dg-finish


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

Reply via email to