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
This commit is contained in:
Janis Johnson 2010-03-03 22:05:30 +00:00 committed by Janis Johnson
parent a84713ad26
commit 8ec49cffc2
4 changed files with 75 additions and 15 deletions

View File

@ -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> 2010-03-03 Jason Merrill <jason@redhat.com>
PR c++/12909 PR c++/12909

View File

@ -1019,7 +1019,7 @@ the test
@item 300 @item 300
@end itemize @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 Arguments @var{include-opts} and @var{exclude-opts} are lists in which
each element is a string of zero or more GCC options. each element is a string of zero or more GCC options.
Skip the test if all of the following conditions are met: 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}, @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 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 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 @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 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 @end itemize
For example, to skip a test if option @code{-Os} is present: 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" @} @} */ /* @{ dg-skip-if "" @{ *-*-* @} @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */
@end smallexample @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 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. @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 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. 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 This directive must appear after any @code{dg-do} directive in the test
and before any @code{dg-additional-sources} directive. 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 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. conditions (which are the same as for @code{dg-skip-if}) are met.

View File

@ -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> 2010-03-03 Jason Merrill <jason@redhat.com>
* g++.dg/abi/mangle19-1.C: Adjust for default -Wabi. * g++.dg/abi/mangle19-1.C: Adjust for default -Wabi.

View File

@ -235,9 +235,26 @@ proc check-flags { args } {
append compiler_flags "[board_info $dest multilib_flags] " append compiler_flags "[board_info $dest multilib_flags] "
} }
# The target list might be an effective-target keyword, so replace # The next two arguments are optional. If they were not specified,
# the original list with "*-*-*", since we already know it matches. # use the defaults.
set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] 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. # Any value in this variable was left over from an earlier test.
set compiler_flags "" set compiler_flags ""
@ -256,14 +273,18 @@ proc check-flags { args } {
# group of tests or flags specified with a previous dg-options command. # group of tests or flags specified with a previous dg-options command.
proc dg-skip-if { args } { 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. # Don't bother if we're already skipping the test.
upvar dg-do-what dg-do-what upvar dg-do-what dg-do-what
if { [lindex ${dg-do-what} 1] == "N" } { if { [lindex ${dg-do-what} 1] == "N" } {
return return
} }
set args [lreplace $args 0 0]
set selector [list target [lindex $args 1]] set selector [list target [lindex $args 1]]
if { [dg-process-target $selector] == "S" } { if { [dg-process-target $selector] == "S" } {
if [check-flags $args] { if [check-flags $args] {
@ -276,31 +297,53 @@ proc dg-skip-if { args } {
# Like check_conditional_xfail, but callable from a dg test. # Like check_conditional_xfail, but callable from a dg test.
proc dg-xfail-if { args } { 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. # Don't change anything if we're already skipping the test.
upvar dg-do-what dg-do-what upvar dg-do-what dg-do-what
if { [lindex ${dg-do-what} 1] == "N" } { if { [lindex ${dg-do-what} 1] == "N" } {
return return
} }
set args [lreplace $args 0 0]
set selector [list target [lindex $args 1]] set selector [list target [lindex $args 1]]
if { [dg-process-target $selector] == "S" } { if { [dg-process-target $selector] == "S" } {
global compiler_conditional_xfail_data 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. # Like dg-xfail-if but for the execute step.
proc dg-xfail-run-if { args } { 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. # Don't bother if we're already skipping the test.
upvar dg-do-what dg-do-what upvar dg-do-what dg-do-what
if { [lindex ${dg-do-what} 1] == "N" } { if { [lindex ${dg-do-what} 1] == "N" } {
return return
} }
set args [lreplace $args 0 0]
set selector [list target [lindex $args 1]] set selector [list target [lindex $args 1]]
if { [dg-process-target $selector] == "S" } { if { [dg-process-target $selector] == "S" } {
if [check-flags $args] { if [check-flags $args] {