proc check-flags { args } {
global compiler_flags
+ global TOOL_OPTIONS
# These variables are from DejaGnu's dg-test.
upvar dg-extra-tool-flags extra_tool_flags
upvar tool_flags tool_flags
set compiler_flags " toolname "
append compiler_flags $extra_tool_flags
append compiler_flags $tool_flags
+ # If running a subset of the test suite, $TOOL_OPTIONS may not exist.
+ catch {append compiler_flags " $TOOL_OPTIONS "}
set dest [target_info name]
if [board_info $dest exists multilib_flags] {
append compiler_flags "[board_info $dest multilib_flags] "
}
}
+# Record whether the program is expected to return a nonzero status.
+
+set shouldfail 0
+
+proc dg-shouldfail { args } {
+ # 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
+ }
+
+ global shouldfail
+
+ set args [lreplace $args 0 0]
+ if { [llength $args] > 1 } {
+ set selector [list target [lindex $args 1]]
+ if { [dg-process-target $selector] == "S" } {
+ # The target matches, now check the flags. These variables
+ # are defined in DejaGnu's dg-test, needed by check-flags.
+ upvar dg-extra-tool-flags dg-extra-tool-flags
+ upvar tool_flags tool_flags
+
+ if [check-flags $args] {
+ set shouldfail 1
+ }
+ }
+ } else {
+ set shouldfail 1
+ }
+}
+
# Intercept the call to the DejaGnu version of dg-process-target to
# support use of an effective-target keyword in place of a list of
# target triplets to xfail or skip a test.