compat.exp: Handle dg-options per source file.

* lib/compat.exp: Handle dg-options per source file.
	* g++.dg/compat/abi/bitfield1_x.C: Specify dg-options.
	* g++.dg/compat/abi/bitfield1_y.C: Ditto.
	* g++.dg/compat/abi/bitfield2_x.C: Ditto.
	* g++.dg/compat/abi/bitfield2_y.C: Ditto.
	* g++.dg/compat/abi/vbase8-10_x.C: Ditto.
	* g++.dg/compat/abi/vbase8-10_y.C: Ditto.
	* g++.dg/compat/abi/vbase8-21_x.C: Ditto.
	* g++.dg/compat/abi/vbase8-21_y.C: Ditto.
	* g++.dg/compat/abi/vbase8-22_x.C: Ditto.
	* g++.dg/compat/abi/vbase8-22_y.C: Ditto.
	* g++.dg/compat/abi/vbase8-4_x.C: Ditto.
	* g++.dg/compat/abi/vbase8-4_y.C: Ditto.
	* g++.dg/compat/break/bitfield7_x.C: Ditto.
	* g++.dg/compat/break/bitfield7_y.C: Ditto.

From-SVN: r69649
This commit is contained in:
Janis Johnson 2003-07-21 21:24:27 +00:00 committed by Janis Johnson
parent 8d973a8319
commit dd039fc9e6
16 changed files with 121 additions and 33 deletions

View File

@ -1,3 +1,21 @@
2003-07-21 Janis Johnson <janis187@us.ibm.com>
* lib/compat.exp: Handle dg-options per source file.
* g++.dg/compat/abi/bitfield1_x.C: Specify dg-options.
* g++.dg/compat/abi/bitfield1_y.C: Ditto.
* g++.dg/compat/abi/bitfield2_x.C: Ditto.
* g++.dg/compat/abi/bitfield2_y.C: Ditto.
* g++.dg/compat/abi/vbase8-10_x.C: Ditto.
* g++.dg/compat/abi/vbase8-10_y.C: Ditto.
* g++.dg/compat/abi/vbase8-21_x.C: Ditto.
* g++.dg/compat/abi/vbase8-21_y.C: Ditto.
* g++.dg/compat/abi/vbase8-22_x.C: Ditto.
* g++.dg/compat/abi/vbase8-22_y.C: Ditto.
* g++.dg/compat/abi/vbase8-4_x.C: Ditto.
* g++.dg/compat/abi/vbase8-4_y.C: Ditto.
* g++.dg/compat/break/bitfield7_x.C: Ditto.
* g++.dg/compat/break/bitfield7_y.C: Ditto.
2003-07-21 Andrew Pinski <pinskia@physics.uc.edu>
PR c/10320

View File

@ -1,3 +1,5 @@
// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
#include "bitfield1.h"
extern void bitfield1_y (A& a);

View File

@ -1,3 +1,5 @@
// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
extern "C" void abort (void);
#include "bitfield1.h"

View File

@ -1,3 +1,5 @@
// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }
#include "bitfield1.h"
extern void bitfield1_y (A& a);

View File

@ -1,3 +1,5 @@
// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }
extern "C" void abort (void);
#include "bitfield1.h"

View File

@ -1,3 +1,5 @@
// { dg-options -w }
#include "vbase8-10.h"
extern void check_C0 (C0&, int);

View File

@ -1,3 +1,5 @@
// { dg-options -w }
extern "C" void abort (void);
#include "vbase8-10.h"

View File

@ -1,3 +1,5 @@
// { dg-options -w }
#include "vbase8-21.h"
extern void check_C0 (C0&, int);

View File

@ -1,3 +1,5 @@
// { dg-options -w }
extern "C" void abort (void);
#include "vbase8-21.h"

View File

@ -1,3 +1,5 @@
// { dg-options -w }
#include "vbase8-22.h"
extern void check_C0 (C0&, int);

View File

@ -1,3 +1,5 @@
// { dg-options -w }
extern "C" void abort (void);
#include "vbase8-22.h"

View File

@ -1,3 +1,5 @@
// { dg-options -w }
#include "vbase8-4.h"
extern void check_C0 (C0&, int);

View File

@ -1,3 +1,5 @@
// { dg-options -w }
extern "C" void abort (void);
#include "vbase8-4.h"

View File

@ -1,3 +1,5 @@
// { dg-options "-w" }
#include "bitfield7.h"
extern void bitfield7_y (U*);

View File

@ -1,3 +1,5 @@
// { dg-options "-w" }
extern "C" void abort (void);
#include "bitfield7.h"

View File

@ -49,18 +49,25 @@ if ![info exists COMPAT_OPTIONS] {
set option_list $COMPAT_OPTIONS
load_lib dg.exp
#
# compat-obj -- compile to an object file
#
# SOURCE is the source file
# DEST is the object file
# OPTIONS is the list of compiler options
# OPTALL is the list of compiler options to use with all tests
# OPTFILE is the list of compiler options to use with this file
# OPTSTR is the options to print with test messages
#
proc compat-obj { source dest options optstr } {
proc compat-obj { source dest optall optfile optstr } {
global testcase
global tool
# Set up the options for compiling this file.
set options ""
lappend options "additional_flags=$optfile $optall"
set comp_output [${tool}_target_compile "$source" "$dest" object $options]
${tool}_check_compile "$testcase $dest compile" $optstr $dest $comp_output
}
@ -70,10 +77,11 @@ proc compat-obj { source dest options optstr } {
# TESTNAME is the mixture of object files to link
# OBJLIST is the list of object files to link
# DEST is the name of the executable
# OPTIONS is a list of compiler and linker options to use
# OPTALL is a list of compiler and linker options to use for all tests
# OPTFILE is a list of compiler and linker options to use for this test
# OPTSTR is the list of options to list in messages
#
proc compat-run { testname objlist dest options optstr } {
proc compat-run { testname objlist dest optall optfile optstr } {
global testcase
global tool
@ -86,6 +94,10 @@ proc compat-run { testname objlist dest options optstr } {
}
}
# Set up the options for linking this test.
set options ""
lappend options "additional_flags=$optfile $optall"
# Link the objects into an executable.
set comp_output [${tool}_target_compile "$objlist" $dest executable \
"$options"]
@ -107,6 +119,48 @@ proc compat-run { testname objlist dest options optstr } {
$status "$testcase $testname execute $optstr"
}
#
# compat-flags -- get special tool flags to use for a source file
#
# SRC is the full patchname of the source file.
# The result is a list of options to use.
#
# This code is copied from proc dg-test in dg.exp from DejaGNU.
#
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.
set dg-extra-tool-flags ""
set tmp [dg-get-options $src]
foreach op $tmp {
set cmd [lindex $op 0]
if ![string compare "dg-options" $cmd] {
set status [catch "$op" errmsg]
if { $status != 0 } {
perror "src: $errmsg for \"$op\"\n"
unresolved "$src: $errmsg for \"$op\""
return
}
} else {
# Ignore unrecognized dg- commands, but warn about them.
warning "compat.exp does not support $cmd"
}
}
# Restore normal error handling.
rename unknown ""
rename dg-save-unknown unknown
return ${dg-extra-tool-flags}
}
#
# compat-execute -- compile with compatible compilers
#
@ -123,27 +177,19 @@ proc compat-execute { src1 sid use_alt } {
global testcase
global gluefile
# Use the dg-options mechanism to specify extra flags for this test.
# FIXME: This does not handle other uses of dg-options, and it only
# processes the first one.
set extra_tool_flags ""
set tmp [grep $src1 "{\[ \t\]\*dg-options.*\[ \t\]\+}"]
if ![string match "" $tmp] {
set tmp0 [lindex $tmp 0]
# Extract the compiler options.
regexp "dg-options\[ \t\]\+(.*)\[ \t\]\+\}" \
$tmp0 all args
# Sometime the options are in quotes, sometimes not.
regsub -all "\"" $args "" args
set extra_tool_flags $args
}
# Set up the names of the other source files.
regsub "_main.*" $src1 "" base
regsub ".*/" $base "" base
regsub "_main" $src1 "_x" src2
regsub "_main" $src1 "_y" src3
# 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
# 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_3 [compat-get-options $src3]
# Define the names of the object files.
regsub "sid" "sid_main_tst.o" $sid obj1
regsub "sid" "sid_x_tst.o" $sid obj2_tst
@ -180,11 +226,6 @@ proc compat-execute { src1 sid use_alt } {
}
verbose "Testing $testcase, $optstr" 1
set tst_options ""
set alt_options ""
lappend tst_options "additional_flags=$extra_tool_flags $tst_option"
lappend alt_options "additional_flags=$extra_tool_flags $alt_option"
# There's a unique name for each executable we generate, based on
# the set of options and how the pieces of the tests are compiled.
set execname1 "${execbase}-${count}1"
@ -202,28 +243,29 @@ proc compat-execute { src1 sid use_alt } {
# later. Skip this if we don't have an alternate compiler.
if { $use_alt != 0 } then {
compat-use-alt-compiler
compat-obj "$src2" "$obj2_alt" $alt_options $optstr
compat-obj "$src3" "$obj3_alt" $alt_options $optstr
compat-obj "$src2" "$obj2_alt" $alt_option $extra_flags_2 $optstr
compat-obj "$src3" "$obj3_alt" $alt_option $extra_flags_3 $optstr
}
# Compile pieces with the compiler under test.
compat-use-tst-compiler
compat-obj "$src1" "$obj1" $tst_options $optstr
compat-obj "$src2" "$obj2_tst" $tst_options $optstr
compat-obj "$src3" "$obj3_tst" $tst_options $optstr
compat-obj "$src1" "$obj1" $tst_option $extra_flags_1 $optstr
compat-obj "$src2" "$obj2_tst" $tst_option $extra_flags_2 $optstr
compat-obj "$src3" "$obj3_tst" $tst_option $extra_flags_3 $optstr
# Link (using the compiler under test), run, and clean up tests.
compat-run "${obj2_tst}-${obj3_tst}" \
"$obj1 $obj2_tst $obj3_tst" $execname1 $tst_options $optstr
"$obj1 $obj2_tst $obj3_tst" $execname1 \
$tst_option $extra_flags_1 $optstr
# If we've got an alternate compiler try some combinations.
if { $use_alt != 0 } then {
compat-run "${obj2_tst}-${obj3_alt}" "$obj1 $obj2_tst $obj3_alt" \
$execname2 $tst_options $optstr
$execname2 $tst_option $extra_flags_1 $optstr
compat-run "${obj2_alt}-${obj3_tst}" "$obj1 $obj2_alt $obj3_tst" \
$execname3 $tst_options $optstr
$execname3 $tst_option $extra_flags_1 $optstr
compat-run "${obj2_alt}-${obj3_alt}" "$obj1 $obj2_alt $obj3_alt" \
$execname4 $tst_options $optstr
$execname4 $tst_option $extra_flags_1 $optstr
}
# Clean up object files.