]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
doc/sourcebuild.texi (Selectors): Document the use of target and xfail used together.
authorJanis Johnson <janisjo@codesourcery.com>
Mon, 24 Sep 2012 15:15:14 +0000 (15:15 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Mon, 24 Sep 2012 15:15:14 +0000 (15:15 +0000)
doc/sourcebuild.texi (Selectors): Document the use of target
and xfail used together.
testsuite/
* lib/target-supports-dg.exp (dg-require-effective-target,
dg-skip-if, dg-xfail-if, dg-xfail-run-if, dg-shouldfail): Call
dg-process-target-1 instead of dg-process-target.
(dg-process-target-1): Rename from dg-process-target.
(dg-process-target): New.

From-SVN: r191670

gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports-dg.exp

index f44e5b5e5c09239a5ee38bfa32bf08f1e77cc6cf..01536e1f99dbff63236bd31724b970352f149fbb 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-24  Janis Johnson  <janisjo@codesourcery.com>
+
+       doc/sourcebuild.texi (Selectors): Document the use of target
+       and xfail used together.
+
 2012-09-24  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/54632
index 055567b65d1b90d6f6ccddce38b5f5725becd23e..2efd79929370080f2ad36c374330c3a217507a85 100644 (file)
@@ -1238,15 +1238,18 @@ on particular targets.
 
 A selector is:
 @itemize @bullet
-@item one or more target triplets, possibly including wildcard characters
+@item one or more target triplets, possibly including wildcard characters;
+use @samp{*-*-*} to match any target
 @item a single effective-target keyword (@pxref{Effective-Target Keywords})
 @item a logical expression
 @end itemize
 
-Depending on the
-context, the selector specifies whether a test is skipped and reported
-as unsupported or is expected to fail.  Use @samp{*-*-*} to match any
-target.
+Depending on the context, the selector specifies whether a test is
+skipped and reported as unsupported or is expected to fail.  A context
+that allows either @samp{target} or @samp{xfail} also allows
+@samp{@{ target @var{selector1} xfail @var{selector2} @}}
+to skip the test for targets that don't match @var{selector1} and the
+test to fail for targets that match @var{selector2}.
 
 A selector expression appears within curly braces and uses a single
 logical operator: one of @samp{!}, @samp{&&}, or @samp{||}.  An
index a0b2bdf0ef6d12caa9e9fcba6a46257cd47e0ea8..2a38fea629101ba837fd00528630e3b91ae4fe0b 100644 (file)
@@ -1,3 +1,11 @@
+2012-09-24  Janis Johnson  <janisjo@codesourcery.com>
+
+       * lib/target-supports-dg.exp (dg-require-effective-target,
+       dg-skip-if, dg-xfail-if, dg-xfail-run-if, dg-shouldfail): Call
+       dg-process-target-1 instead of dg-process-target.
+       (dg-process-target-1): Rename from dg-process-target.
+       (dg-process-target): New.
+
 2012-09-24  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/54684
index 5ee4b10ca8f51a33b23ac3d4a849a30132105441..3e3a3d0cea608ef01c327223aadf1be351ca4b9f 100644 (file)
@@ -208,7 +208,7 @@ proc dg-require-effective-target { args } {
     
     # Evaluate selector if present.
     if { [llength $args] == 2 } {
-       switch [dg-process-target [lindex $args 1]] {
+       switch [dg-process-target-1 [lindex $args 1]] {
            "S" { }
            "N" { return }
        }
@@ -362,7 +362,7 @@ proc dg-skip-if { args } {
     }
 
     set selector [list target [lindex $args 1]]
-    if { [dg-process-target $selector] == "S" } {
+    if { [dg-process-target-1 $selector] == "S" } {
        if [check-flags $args] {
            upvar dg-do-what dg-do-what
             set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
@@ -386,7 +386,7 @@ proc dg-xfail-if { args } {
     }
 
     set selector [list target [lindex $args 1]]
-    if { [dg-process-target $selector] == "S" } {
+    if { [dg-process-target-1 $selector] == "S" } {
        global compiler_conditional_xfail_data
 
        # The target list might be an effective-target keyword.  Replace
@@ -421,7 +421,7 @@ proc dg-xfail-run-if { args } {
     }
 
     set selector [list target [lindex $args 1]]
-    if { [dg-process-target $selector] == "S" } {
+    if { [dg-process-target-1 $selector] == "S" } {
        if [check-flags $args] {
            upvar dg-do-what dg-do-what
             set dg-do-what [list [lindex ${dg-do-what} 0] "S" "F"]
@@ -445,7 +445,7 @@ proc dg-shouldfail { args } {
     set args [lreplace $args 0 0]
     if { [llength $args] > 1 } {
        set selector [list target [lindex $args 1]]
-       if { [dg-process-target $selector] == "S" } {
+       if { [dg-process-target-1 $selector] == "S" } {
            # The target matches, now check the flags.
            if [check-flags $args] {
                set shouldfail 1
@@ -460,16 +460,19 @@ proc dg-shouldfail { args } {
 # support use of an effective-target keyword in place of a list of
 # target triplets to xfail or skip a test.
 #
-# selector is one of:
-#    xfail target-triplet-1 ...
-#    xfail effective-target-keyword
-#    xfail selector-expression
-#    target target-triplet-1 ...
-#    target effective-target-keyword
-#    target selector-expression
+# The argument to dg-process-target is the keyword "target" or "xfail"
+# followed by a selector:
+#    target-triplet-1 ...
+#    effective-target-keyword
+#    selector-expression
 #
 # For a target list the result is "S" if the target is selected, "N" otherwise.
 # For an xfail list the result is "F" if the target is affected, "P" otherwise.
+
+# In contexts that allow either "target" or "xfail" the argument can be
+#    target selector1 xfail selector2
+# which returns "N" if selector1 is not selected, otherwise the result of
+# "xfail selector2".
 #
 # A selector expression appears within curly braces and uses a single logical
 # operator: !, &&, or ||.  An operand is another selector expression, an
@@ -529,9 +532,11 @@ if { [info procs saved-dg-process-target] == [list] } {
        return $answer
     }
 
-    proc dg-process-target { args } {
-       verbose "replacement dg-process-target: `$args'" 2
-       
+    # Evaluate "target selector" or "xfail selector".
+
+    proc dg-process-target-1 { args } {
+       verbose "dg-process-target-1: `$args'" 2
+
        # Extract the 'what' keyword from the argument list.
        set selector [string trim [lindex $args 0]]
        if [regexp "^xfail " $selector] {
@@ -567,4 +572,29 @@ if { [info procs saved-dg-process-target] == [list] } {
        # the list of target triplets.
        return [saved-dg-process-target $selector]
     }
+
+    # Intercept calls to the DejaGnu function.  In addition to
+    # processing "target selector" or "xfail selector", handle
+    # "target selector1 xfail selector2".
+
+    proc dg-process-target { args } {
+       verbose "replacement dg-process-target: `$args'" 2
+
+       set selector [string trim [lindex $args 0]]
+
+       # If the argument list contains both 'target' and 'xfail',
+       # process 'target' and, if that succeeds, process 'xfail'.
+       if [regexp "^target .* xfail .*" $selector] {
+           set xfail_index [string first "xfail" $selector]
+           set xfail_selector [string range $selector $xfail_index end]
+           set target_selector [string range $selector 0 $xfail_index-1]
+           set target_selector [string trim $target_selector]
+           if { [dg-process-target-1 $target_selector] == "N" } {
+               return "N"
+           }
+           return [dg-process-target-1 $xfail_selector]
+           
+       }
+       return [dg-process-target-1 $selector]
+    }
 }