Re: Multiple dg-do do not work.

Dominik Vogt <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
On Wed, Mar 09, 2016 at 11:18:28AM +1100, Ben Elliston wrote:
> On Tue, Mar 08, 2016 at 02:29:10PM +0100, Dominik Vogt wrote:
> 
> > However, multiple dg-do don't seem to work:
> > 
> >   dg-do run { condition }
> >   dg-do assemble { ! condition }
> 
> There are plenty of examples of this in the testsuite. You may wish to
> investigate further:
> 
>   $ grep -r dg-do . | awk -F: '{print $1}' | uniq -d
> 
> For example, the top of gcc.target/powerpc/altivec-3.c says:
> 
>   /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
>   /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
> 
> So compile awyas on powerpc-*-*, but only run if the taget has the
> right hardware.  It should certainly work.  If it doesn't, please send
> a patch!

The problem is really that if a condition deselects a test
(dg-process-target returns 'N'), and an earlier dg-do already
selected the test, the first word of $dg-what still gets replaced
by the new (deselected) action.  E.g.

 * $dg-what is "compile {} P" at first (default value)
 * becomes "run S P" after evaluating the selected "dg-do run"
 * becomes "assemble S P" after ervaluating deselected "dg-do" assemble.

The attached patch fixes the problem for me by not changing the
action if a deselected dg-do is encountered.  Note that my
knowledge of Tcl is about zero, so there may be any number of bugs
in that patch.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
dg.exp.patch (text/x-diff, 725 B)
--- dg.exp.orig	2013-08-03 09:27:13.000000000 +0200
+++ dg.exp	2016-03-09 13:45:41.000000000 +0100
@@ -313,6 +313,7 @@
 	return
     }
 
+    set doaction [lindex $args 1]
     set selected [lindex ${do-what} 1]	;# selected? (""/S/N)
     set expected [lindex ${do-what} 2]	;# expected to pass/fail (P/F)
 
@@ -330,6 +331,8 @@
 		# are OR'd together).
 		if { $selected != "S" } {
 		    set selected "N"
+		} else {
+		    set doaction [lindex ${do-what} 0]
 		}
 	    }
 	    "F" { set expected "F" }
@@ -355,7 +358,7 @@
 	    error "[lindex $args 0]: syntax error"
 	}
     }
-    set do-what [list [lindex $args 1] $selected $expected]
+    set do-what [list $doaction $selected $expected]
 }
 
 proc dg-error { args } {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.