diff options
author | Janis Johnson <janis187@us.ibm.com> | 2003-07-21 21:24:27 +0000 |
---|---|---|
committer | Janis Johnson <janis@gcc.gnu.org> | 2003-07-21 21:24:27 +0000 |
commit | dd039fc9e6cc2bf9214cb0ff87a07d0346829a59 (patch) | |
tree | 67c08346367763841fe6430445e149d68dd34559 /gcc | |
parent | 8d973a83191104c5d91784b18746c6ecc1ec93e4 (diff) | |
download | gcc-dd039fc9e6cc2bf9214cb0ff87a07d0346829a59.zip gcc-dd039fc9e6cc2bf9214cb0ff87a07d0346829a59.tar.gz gcc-dd039fc9e6cc2bf9214cb0ff87a07d0346829a59.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/break/bitfield7_x.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/compat/break/bitfield7_y.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/lib/compat.exp | 108 |
16 files changed, 121 insertions, 33 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0652a9..ec60181 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C b/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C index 1447655..e081c4b 100644 --- a/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1_x.C @@ -1,3 +1,5 @@ +// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" } + #include "bitfield1.h" extern void bitfield1_y (A& a); diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C b/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C index 7ca5d4b..10581da 100644 --- a/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/bitfield1_y.C @@ -1,3 +1,5 @@ +// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" } + extern "C" void abort (void); #include "bitfield1.h" diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C b/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C index 1447655..47b448d 100644 --- a/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2_x.C @@ -1,3 +1,5 @@ +// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" } + #include "bitfield1.h" extern void bitfield1_y (A& a); diff --git a/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C b/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C index 6119544..55edab5 100644 --- a/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/bitfield2_y.C @@ -1,3 +1,5 @@ +// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" } + extern "C" void abort (void); #include "bitfield1.h" diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C index 18e78fc..c56d080 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_x.C @@ -1,3 +1,5 @@ +// { dg-options -w } + #include "vbase8-10.h" extern void check_C0 (C0&, int); diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C index 1d6c826..5364ed6 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-10_y.C @@ -1,3 +1,5 @@ +// { dg-options -w } + extern "C" void abort (void); #include "vbase8-10.h" diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C index 986fcfb..818eade 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_x.C @@ -1,3 +1,5 @@ +// { dg-options -w } + #include "vbase8-21.h" extern void check_C0 (C0&, int); diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C index 0bd7624..5126139 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-21_y.C @@ -1,3 +1,5 @@ +// { dg-options -w } + extern "C" void abort (void); #include "vbase8-21.h" diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C index 5d3eacf..49f021a 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_x.C @@ -1,3 +1,5 @@ +// { dg-options -w } + #include "vbase8-22.h" extern void check_C0 (C0&, int); diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C index 293ed10..49ab04a 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-22_y.C @@ -1,3 +1,5 @@ +// { dg-options -w } + extern "C" void abort (void); #include "vbase8-22.h" diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C index 66b514c..db60cc6 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_x.C @@ -1,3 +1,5 @@ +// { dg-options -w } + #include "vbase8-4.h" extern void check_C0 (C0&, int); diff --git a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C index 86dd404..24d5046 100644 --- a/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C +++ b/gcc/testsuite/g++.dg/compat/abi/vbase8-4_y.C @@ -1,3 +1,5 @@ +// { dg-options -w } + extern "C" void abort (void); #include "vbase8-4.h" diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C b/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C index b42ea2e..9b2a622 100644 --- a/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C +++ b/gcc/testsuite/g++.dg/compat/break/bitfield7_x.C @@ -1,3 +1,5 @@ +// { dg-options "-w" } + #include "bitfield7.h" extern void bitfield7_y (U*); diff --git a/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C b/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C index 916d150..afa5446 100644 --- a/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C +++ b/gcc/testsuite/g++.dg/compat/break/bitfield7_y.C @@ -1,3 +1,5 @@ +// { dg-options "-w" } + extern "C" void abort (void); #include "bitfield7.h" diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp index 67d60ec..2926d0b 100644 --- a/gcc/testsuite/lib/compat.exp +++ b/gcc/testsuite/lib/compat.exp @@ -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"] @@ -108,6 +120,48 @@ proc compat-run { testname objlist dest options 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 # # SRC1 is the full pathname of the main file of the testcase. @@ -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. |