diff options
author | Janis Johnson <janis187@us.ibm.com> | 2010-03-03 22:05:30 +0000 |
---|---|---|
committer | Janis Johnson <janis@gcc.gnu.org> | 2010-03-03 22:05:30 +0000 |
commit | 8ec49cffc2ab188190544d494b8bb7907732d17e (patch) | |
tree | b7aef3740414b72a1357ba8c9a64141be8bc2c72 | |
parent | a84713ad264845bbbcad973031a3ef3f56064f33 (diff) | |
download | gcc-8ec49cffc2ab188190544d494b8bb7907732d17e.zip gcc-8ec49cffc2ab188190544d494b8bb7907732d17e.tar.gz gcc-8ec49cffc2ab188190544d494b8bb7907732d17e.tar.bz2 |
sourcebuild.texi (Test directives): Document that arguments include-opts and exclude-opts are now optional for...
* doc/sourcebuild.texi (Test directives): Document that arguments
include-opts and exclude-opts are now optional for dg-skip-if,
dg-xfail-if, dg-xfail-run-if, and dg-shouldfail.
* lib/target-supports-dg.exp (check-flags): Provide defaults for
include-opts and exclude-opts; skip checking the flags if arguments
are the same as the defaults.
(dg-xfail-if): Verify the number of arguments, supply defaults
for unspecified optional arguments.
(dg-skip-if, dg-xfail-run-if): Verify the number of arguments.
From-SVN: r157206
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/doc/sourcebuild.texi | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports-dg.exp | 61 |
4 files changed, 75 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b749f4..a65ea60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-03 Janis Johnson <janis187@us.ibm.com> + + * doc/sourcebuild.texi (Test directives): Document that arguments + include-opts and exclude-opts are now optional for dg-skip-if, + dg-xfail-if, dg-xfail-run-if, and dg-shouldfail. + 2010-03-03 Jason Merrill <jason@redhat.com> PR c++/12909 diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 033615b..ee55458 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1019,7 +1019,7 @@ the test @item 300 @end itemize -@item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} +@item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} Arguments @var{include-opts} and @var{exclude-opts} are lists in which each element is a string of zero or more GCC options. Skip the test if all of the following conditions are met: @@ -1029,11 +1029,13 @@ Skip the test if all of the following conditions are met: @item for at least one of the option strings in @var{include-opts}, every option from that string is in the set of options with which the test would be compiled; use @samp{"*"} for an @var{include-opts} list -that matches any options +that matches any options; that is the default if @var{include-opts} is +not specified @item for each of the option strings in @var{exclude-opts}, at least one option from that string is not in the set of options with which the test -would be compiled; use @samp{""} for an empty @var{exclude-opts} list +would be compiled; use @samp{""} for an empty @var{exclude-opts} list; +that is the default if @var{exclude-opts} is not specified @end itemize For example, to skip a test if option @code{-Os} is present: @@ -1067,11 +1069,11 @@ but not if @code{-fpic} is also present: /* @{ dg-skip-if "" @{ *-*-* @} @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */ @end smallexample -@item @{ dg-xfail-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} +@item @{ dg-xfail-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} Expect the test to fail if the conditions (which are the same as for @code{dg-skip-if}) are met. This does not affect the execute step. -@item @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} +@item @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} Expect the execute step of a test to fail if the conditions (which are the same as for @code{dg-skip-if}) and @code{dg-xfail-if}) are met. @@ -1089,7 +1091,7 @@ is not covered by the effective-target keyword. This directive must appear after any @code{dg-do} directive in the test and before any @code{dg-additional-sources} directive. -@item @{ dg-shouldfail @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} +@item @{ dg-shouldfail @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @} Expect the test executable to return a nonzero exit status if the conditions (which are the same as for @code{dg-skip-if}) are met. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f7da37..c06fe36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2010-03-03 Janis Johnson <janis187@us.ibm.com> + + * lib/target-supports-dg.exp (check-flags): Provide defaults for + include-opts and exclude-opts; skip checking the flags if arguments + are the same as the defaults. + (dg-xfail-if): Verify the number of arguments, supply defaults + for unspecified optional arguments. + (dg-skip-if, dg-xfail-run-if): Verify the number of arguments. + 2010-03-03 Jason Merrill <jason@redhat.com> * g++.dg/abi/mangle19-1.C: Adjust for default -Wabi. diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index ac88a7f..12631fa 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -235,9 +235,26 @@ proc check-flags { args } { append compiler_flags "[board_info $dest multilib_flags] " } - # The target list might be an effective-target keyword, so replace - # the original list with "*-*-*", since we already know it matches. - set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + # The next two arguments are optional. If they were not specified, + # use the defaults. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + # If the option strings are the defaults, or the same as the + # defaults, there is no need to call check_conditional_xfail to + # compare them to the actual options. + if { [string compare [lindex $args 2] "*"] == 0 + && [string compare [lindex $args 3] "" ] == 0 } { + set result 1 + } else { + # The target list might be an effective-target keyword, so replace + # the original list with "*-*-*", since we already know it matches. + set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + } # Any value in this variable was left over from an earlier test. set compiler_flags "" @@ -256,14 +273,18 @@ proc check-flags { args } { # group of tests or flags specified with a previous dg-options command. proc dg-skip-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-skip-if 2: need 2, 3, or 4 arguments" + } + # 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 } - set args [lreplace $args 0 0] - set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { if [check-flags $args] { @@ -276,31 +297,53 @@ proc dg-skip-if { args } { # Like check_conditional_xfail, but callable from a dg test. proc dg-xfail-if { args } { + # Verify the number of arguments. The last three are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-xfail-if: need 2, 3, or 4 arguments" + } + # Don't change anything if we're already skipping the test. upvar dg-do-what dg-do-what if { [lindex ${dg-do-what} 1] == "N" } { return } - set args [lreplace $args 0 0] set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data - set compiler_conditional_xfail_data [lreplace $args 1 1 "*-*-*"] + + # The target list might be an effective-target keyword. Replace + # the original list with "*-*-*", since we already know it matches. + set args [lreplace $args 1 1 "*-*-*"] + + # Supply default values for unspecified optional arguments. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + set compiler_conditional_xfail_data $args } } # Like dg-xfail-if but for the execute step. proc dg-xfail-run-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-xfail-run-if: need 2, 3, or 4 arguments" + } + # 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 } - set args [lreplace $args 0 0] - set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { if [check-flags $args] { |