Commit 5ab8e5cc by Janis Johnson Committed by Janis Johnson

compat.exp (compat-get-options-main): New.

2004-05-25  Janis Johnson  <janis187@us.ibm.com>

	* lib/compat.exp (compat-get-options-main): New.
	(compat-get-options): Remove unneeded code, warn for ignored
	command.
	(compat-execute): Check flag set by dg-require-* commands.

From-SVN: r82261
parent 74f48aee
2004-05-25 Janis Johnson <janis187@us.ibm.com> 2004-05-25 Janis Johnson <janis187@us.ibm.com>
* lib/compat.exp (compat-get-options-main): New.
(compat-get-options): Remove unneeded code, warn for ignored
command.
(compat-execute): Check flag set by dg-require-* commands.
* lib/compat.exp (compat-execute): Break up long lines. * lib/compat.exp (compat-execute): Break up long lines.
2004-05-24 Janis Johnson <janis187@us.ibm.com> 2004-05-24 Janis Johnson <janis187@us.ibm.com>
......
# Copyright (C) 2002 Free Software Foundation, Inc. # Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -147,22 +147,52 @@ proc compat-run { testname objlist dest optall optfile optstr } { ...@@ -147,22 +147,52 @@ proc compat-run { testname objlist dest optall optfile optstr } {
} }
# #
# compat-get-options -- get special tool flags to use for a source file # compat-get-options-main -- get target requirements for a test and
# options for the primary source file and the test as a whole
# #
# SRC is the full patchname of the source file. # SRC is the full pathname of the primary source file.
#
proc compat-get-options-main { src } {
# dg-options sets a variable called dg-extra-tool-flags.
set dg-extra-tool-flags ""
# dg-require-* sets dg-do-what.
upvar dg-do-what dg-do-what
set tmp [dg-get-options $src]
foreach op $tmp {
set cmd [lindex $op 0]
if { ![string compare "dg-options" $cmd] \
|| [string match "dg-require-*" $cmd] } {
set status [catch "$op" errmsg]
if { $status != 0 } {
perror "src: $errmsg for \"$op\"\n"
unresolved "$src: $errmsg for \"$op\""
return
}
} elseif { ![string compare "dg-xfail-if" $cmd] } {
warning "compat.exp does not support $cmd in primary source file"
} else {
# Ignore unrecognized dg- commands, but warn about them.
warning "compat.exp does not support $cmd"
}
}
# Return flags to use for compiling the primary source file and for
# linking.
return ${dg-extra-tool-flags}
}
#
# compat-get-options -- get special tool flags to use for a secondary
# source file
#
# SRC is the full pathname of the source file.
# The result is a list of options to use. # The result is a list of options to use.
# #
# This code is copied from proc dg-test in dg.exp from DejaGNU. # This code is copied from proc dg-test in dg.exp from DejaGNU.
# #
proc compat-get-options { src } { proc compat-get-options { src } {
# Define our own special function `unknown` so we catch spelling errors.
# But first rename the existing one so we can restore it afterwards.
catch {rename dg-save-unknown ""}
rename unknown dg-save-unknown
proc unknown { args } {
return -code error "unknown dg option: $args"
}
# dg-options sets a variable called dg-extra-tool-flags. # dg-options sets a variable called dg-extra-tool-flags.
set dg-extra-tool-flags "" set dg-extra-tool-flags ""
...@@ -181,16 +211,14 @@ proc compat-get-options { src } { ...@@ -181,16 +211,14 @@ proc compat-get-options { src } {
unresolved "$src: $errmsg for \"$op\"" unresolved "$src: $errmsg for \"$op\""
return return
} }
} elseif { [string match "dg-require-*" $cmd] } {
warning "compat.exp does not support $cmd in secondary source files"
} else { } else {
# Ignore unrecognized dg- commands, but warn about them. # Ignore unrecognized dg- commands, but warn about them.
warning "compat.exp does not support $cmd" warning "compat.exp does not support $cmd"
} }
} }
# Restore normal error handling.
rename unknown ""
rename dg-save-unknown unknown
return ${dg-extra-tool-flags} return ${dg-extra-tool-flags}
} }
...@@ -210,6 +238,21 @@ proc compat-execute { src1 sid use_alt } { ...@@ -210,6 +238,21 @@ proc compat-execute { src1 sid use_alt } {
global testcase global testcase
global gluefile global gluefile
global compiler_conditional_xfail_data global compiler_conditional_xfail_data
global dg-do-what-default
# Get extra flags for this test from the primary source file, and
# process other dg-* options that this suite supports. Warn about
# unsupported flags.
verbose "compat-execute: $src1" 1
set dg-do-what [list ${dg-do-what-default} "" P]
set extra_flags_1 [compat-get-options-main $src1]
# Check whether this test is supported for this target.
if { [lindex ${dg-do-what} 1 ] == "N" } {
unsupported "$src1"
verbose "$src1 not supported on this target, skipping it" 3
return
}
# Set up the names of the other source files. # Set up the names of the other source files.
regsub "_main.*" $src1 "" base regsub "_main.*" $src1 "" base
...@@ -220,7 +263,6 @@ proc compat-execute { src1 sid use_alt } { ...@@ -220,7 +263,6 @@ proc compat-execute { src1 sid use_alt } {
# Use the dg-options mechanism to specify extra flags for this test. # Use the dg-options mechanism to specify extra flags for this test.
# The extra flags in each file are used to compile that file, and the # The extra flags in each file are used to compile that file, and the
# extra flags in *_main.* are also used for linking. # extra flags in *_main.* are also used for linking.
set extra_flags_1 [compat-get-options $src1]
set extra_flags_2 [compat-get-options $src2] set extra_flags_2 [compat-get-options $src2]
set compile_xfail_2 $compiler_conditional_xfail_data set compile_xfail_2 $compiler_conditional_xfail_data
set extra_flags_3 [compat-get-options $src3] set extra_flags_3 [compat-get-options $src3]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment