Patchwork [testsuite] dg-require-effective-target: skip unneeded checks

login
register
mail settings
Submitter Janis Johnson
Date June 21, 2011, 9:02 p.m.
Message ID <4E0106DD.1050307@codesourcery.com>
Download mbox | patch
Permalink /patch/101366/
State New
Headers show

Comments

Janis Johnson - June 21, 2011, 9:02 p.m.
This patch causes dg-require-effective-target to return early if the
test is already being skipped, saving some work.  There's already
similar code in dg-skip-if.

OK for trunk, and later for 4.6?
2011-06-21  Janis Johnson  <janisjo@codesourcery.com>

	* lib/target-supports-dg.exp (dg-require-effective-target): Return
	early if the test is already being skipped.
Mike Stump - June 25, 2011, 11:40 p.m.
On Jun 21, 2011, at 2:02 PM, Janis Johnson wrote:
> This patch causes dg-require-effective-target to return early if the
> test is already being skipped, saving some work.  There's already
> similar code in dg-skip-if.
> 
> OK for trunk, and later for 4.6?

Ok.  Ok for 4.6.  I'm not a huge fan of upvar, but, you didn't create the problem, so, you don't have to fix it.

Patch

Index: lib/target-supports-dg.exp
===================================================================
--- lib/target-supports-dg.exp	(revision 175269)
+++ lib/target-supports-dg.exp	(working copy)
@@ -172,6 +172,12 @@ 
     if { [llength $args] < 1 || [llength $args] > 2 } {
 	error "syntax error, need a single effective-target keyword with optional selector"
     }
+
+    # Don't bother if we're already skipping the test.
+    upvar dg-do-what dg-do-what
+    if { [lindex ${dg-do-what} 1] == "N" } {
+      return
+    }
     
     # Evaluate selector if present.
     if { [llength $args] == 2 } {
@@ -182,7 +188,6 @@ 
     }
 
     if { ![is-effective-target [lindex $args 0]] } {
-	upvar dg-do-what dg-do-what
         set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
     }
 }