+# Compare flags for a test directive against flags that will be used to
+# compile the test: multilib flags, flags for torture options, and either
+# the default flags for this group of tests or flags specified with a
+# previous dg-options directive.
+
+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
+
+ # The args are within another list; pull them out.
+ set args [lindex $args 0]
+
+ # Start the list with a dummy tool name so the list will match "*"
+ # if there are no 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] "
+ }
+
+ # 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 ""
+
+ return $result
+}
+