diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca874aaa715..daf275fe998 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,55 @@ +2003-06-05 Mark Mitchell + + * lib/gcc-defs.exp (additional_sources): New variable. + (dg-additional-sources): New function. + (additional_files): New variable. + (dg-additional-files): New function. + (dg-additional-files-options): Likewise. + * lib/gcc-dg.exp (dg-require-weak): New function. + (dg-require-alias): Likewise. + (dg-require-gc-sections): Likewise. + * lib/target-supports.exp (check_alias_available): Remove testfile + parameter. + (check_gc_sections_available): New function. + * lib/g++-dg.exp (dg-gpp-additional-sources): Remove. + (dg-gpp-additional-files): Likewise. + * lib/g++.exp (additional_sources): Remove. + (additional_files): Likewise. + (g++_target_compile): Use dg-additional-files-options. + + * gcc.dg/special/special.exp: Add "ecos" tests. Remove complex + Tcl logic. + * gcc.dg/special/ecos.exp: Remove. + * gcc.dg/special/20000419-2.c: Use dg-require-*. + * gcc.dg/special/alias-1.c: Likewise. + * gcc.dg/special/alias-2.c: Likewise. + * gcc.dg/special/gcsec-1.c: Likewise. + * gcc.dg/special/weak-1.c: Likewise. + * gcc.dg/special/weak-2.c: Likewise. + * gcc.dg/special/wkali-1.c: Likewise. + * gcc.dg/special/wkali-2.c: Likewise. + + * g++.dg/special/conpr-2.C: Use dg-additional-*, not + dg-gpp-additional-*. + * g++.dg/special/conpr-3.C: Likewise. + * g++.dg/special/conpr-4.C: Likewise. + * g++.old-deja/g++.abi/vtable3a.C: Likewise. + * g++.old-deja/g++.abi/vtable3b.C: Likewise. + * g++.old-deja/g++.abi/vtable3c.C: Likewise. + * g++.old-deja/g++.abi/vtable3d.C: Likewise. + * g++.old-deja/g++.abi/vtable3e.C: Likewise. + * g++.old-deja/g++.abi/vtable3f.C: Likewise. + * g++.old-deja/g++.abi/vtable3g.C: Likewise. + * g++.old-deja/g++.abi/vtable3h.C: Likewise. + * g++.old-deja/g++.abi/vtable3i.C: Likewise. + * g++.old-deja/g++.abi/vtable3j.C: Likewise. + * g++.old-deja/g++.oliva/linkage1.C: Likewise. + * g++.old-deja/g++.other/comdat1.C: Likewise. + * g++.old-deja/g++.other/comdat2.C: Likewise. + * g++.old-deja/g++.other/comdat3.C: Likewise. + * g++.old-deja/g++.other/ctor1.C: Likewise. + * g++.old-deja/g++.pt/instantiate5.C: Likewise. + 2003-06-05 Richard Henderson * gcc.dg/debug/20030605-1.c: New. diff --git a/gcc/testsuite/g++.dg/special/conpr-2.C b/gcc/testsuite/g++.dg/special/conpr-2.C index 9c482b95fb6..67333c8a98b 100644 --- a/gcc/testsuite/g++.dg/special/conpr-2.C +++ b/gcc/testsuite/g++.dg/special/conpr-2.C @@ -1,6 +1,6 @@ /* This doesn't work on solaris2 for reasons described in PR 6482. */ /* { dg-do run { xfail *-*-solaris2* } } */ -/* { dg-gpp-additional-sources "conpr-2a.cc" } */ +/* { dg-additional-sources "conpr-2a.cc" } */ #include diff --git a/gcc/testsuite/g++.dg/special/conpr-3.C b/gcc/testsuite/g++.dg/special/conpr-3.C index 3fe5741f546..04a080bacef 100644 --- a/gcc/testsuite/g++.dg/special/conpr-3.C +++ b/gcc/testsuite/g++.dg/special/conpr-3.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-gpp-additional-sources "conpr-3a.cc conpr-3b.cc" } */ +/* { dg-additional-sources "conpr-3a.cc conpr-3b.cc" } */ #include diff --git a/gcc/testsuite/g++.dg/special/conpr-4.C b/gcc/testsuite/g++.dg/special/conpr-4.C index 68ac543ad1c..c04d188ad70 100644 --- a/gcc/testsuite/g++.dg/special/conpr-4.C +++ b/gcc/testsuite/g++.dg/special/conpr-4.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-gpp-additional-sources "conpr-3b.cc conpr-3a.cc" } */ +/* { dg-additional-sources "conpr-3b.cc conpr-3a.cc" } */ #include diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C index 5e272e1f76a..d2eaa562ddb 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3a.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C index daa25b9cfb6..1a108f8cc1d 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3b.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C index 3bc2de5a736..c7b1365b679 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3c.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C index b0a662ce45b..82edae697d6 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3d.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C index b3040181787..e8469cf422e 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3e.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C index f8356c39125..c604af88920 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3f.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C index 111b80cae4a..9218f40776a 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3g.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C index f2b3a0dde65..1a756fe62d5 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3h.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C index d9861d56343..a71087bd4b3 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3i.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C index 03832ae4da1..de4f590def5 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable3j.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-files "vtable3.h" } +// { dg-additional-files "vtable3.h" } // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 4 February 2001 diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C index 57ef45ff911..23295ea363d 100644 --- a/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C +++ b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C @@ -1,5 +1,5 @@ // { dg-do link } -// { dg-gpp-additional-sources " linkage1-main.cc" } +// { dg-additional-sources " linkage1-main.cc" } // Copyright 2002 Free Software Foundation diff --git a/gcc/testsuite/g++.old-deja/g++.other/comdat1.C b/gcc/testsuite/g++.old-deja/g++.other/comdat1.C index 073260b0a47..a60c865935c 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/comdat1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/comdat1.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-sources " comdat1-aux.cc" } +// { dg-additional-sources " comdat1-aux.cc" } // { dg-options "-O" } // Test that statics in inline functions are unified between // translation units. Currently we handle this by just suppressing diff --git a/gcc/testsuite/g++.old-deja/g++.other/comdat2.C b/gcc/testsuite/g++.old-deja/g++.other/comdat2.C index aaa3d7431a6..5c44d0c33bd 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/comdat2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/comdat2.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-sources " comdat2-aux.cc" } +// { dg-additional-sources " comdat2-aux.cc" } // { dg-options "-O" } // Test that statics in inline functions are unified between // translation units. Currently we handle this by just suppressing diff --git a/gcc/testsuite/g++.old-deja/g++.other/comdat3.C b/gcc/testsuite/g++.old-deja/g++.other/comdat3.C index 3ac9638142a..2a538cad924 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/comdat3.C +++ b/gcc/testsuite/g++.old-deja/g++.other/comdat3.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-sources " comdat3-aux.cc" } +// { dg-additional-sources " comdat3-aux.cc" } // Test that duplicate elimination of implicit instantiations of static // data members works properly. diff --git a/gcc/testsuite/g++.old-deja/g++.other/ctor1.C b/gcc/testsuite/g++.old-deja/g++.other/ctor1.C index 5baf41b051d..e813d20b15b 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/ctor1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/ctor1.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-gpp-additional-sources " ctor1-aux.cc" } +// { dg-additional-sources " ctor1-aux.cc" } // Origin: Mark Mitchell diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C index 70ec4125519..21d8b334732 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C @@ -1,5 +1,5 @@ // { dg-do link } -// { dg-gpp-additional-sources " instantiate5.cc instantiate5-main.cc" } +// { dg-additional-sources " instantiate5.cc instantiate5-main.cc" } // `global constructors' are given the same name, based on foo(), on // both translation units, which is wrong, because it must be possible diff --git a/gcc/testsuite/gcc.dg/special/20000419-2.c b/gcc/testsuite/gcc.dg/special/20000419-2.c index 05e4729572c..9b468115a94 100644 --- a/gcc/testsuite/gcc.dg/special/20000419-2.c +++ b/gcc/testsuite/gcc.dg/special/20000419-2.c @@ -1,6 +1,7 @@ /* A static function with a global alias should not get 'defined but not used' warnings. Exposed by Linux kernel. */ /* { dg-do compile } */ +/* { dg-require-alias } */ /* { dg-options "-Wall" } */ extern void do_something (void); diff --git a/gcc/testsuite/gcc.dg/special/alias-1.c b/gcc/testsuite/gcc.dg/special/alias-1.c index d58393179a8..6798c5be4c6 100644 --- a/gcc/testsuite/gcc.dg/special/alias-1.c +++ b/gcc/testsuite/gcc.dg/special/alias-1.c @@ -1,4 +1,5 @@ /* { dg-do link } */ +/* { dg-require-alias "" } */ #include diff --git a/gcc/testsuite/gcc.dg/special/alias-2.c b/gcc/testsuite/gcc.dg/special/alias-2.c index 5dd9f537cb0..4cc8ce150f1 100644 --- a/gcc/testsuite/gcc.dg/special/alias-2.c +++ b/gcc/testsuite/gcc.dg/special/alias-2.c @@ -1,5 +1,6 @@ /* PR 3997 */ /* { dg-do run } */ +/* { dg-require-alias "" } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/special/ecos.exp b/gcc/testsuite/gcc.dg/special/ecos.exp deleted file mode 100644 index 835233f1d4b..00000000000 --- a/gcc/testsuite/gcc.dg/special/ecos.exp +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# jlarmour@cygnus.co.uk - -# This file was written by Jonathan Larmour (jlarmour@cygnus.co.uk). - -# GCC testsuite that uses the `dg.exp' driver. - -# Load support procs. -load_lib gcc-dg.exp - -############################### -# proc gcc_target_object_format {} -############################### -# has been moved to: gcc/testsuite/lib/file-format.exp - -############################### -# proc check_weak_available { } -############################### -# has been moved to: gcc/testsuite/lib/target-supports.exp - -########## -# weak-1.c -########## - -if { [ check_weak_available ] == 1 } { - dg-init - - set lines [gcc_target_compile "$srcdir/$subdir/weak-1a.c" "weak-1a.o" object ""] - if ![string match "" $lines] then { - fail "weak-1a.o" - } else { - dg-runtest "$srcdir/$subdir/weak-1.c" "weak-1a.o" "" - file delete weak-1a.o - } - dg-finish -} elseif { [ check_weak_available ] == 0 } { - unsupported "weak-1.c" -} else { - unresolved "weak-1.c" -} - -########## -# weak-2.c -########## - -if { [ check_weak_available ] == 1 } { - dg-init - - set lines [gcc_target_compile "$srcdir/$subdir/weak-2a.c" "weak-2a.o" object ""] - if ![string match "" $lines] then { - fail "weak-2a.o" - } else { - set lines [gcc_target_compile "$srcdir/$subdir/weak-2b.c" "weak-2b.o" object ""] - if ![string match "" $lines] then { - fail "weak-2b.o" - } else { - dg-runtest "$srcdir/$subdir/weak-2.c" "weak-2a.o weak-2b.o" "" - file delete weak-2a.o weak-2b.o - } - } - dg-finish -} elseif { [ check_weak_available ] == 0 } { - unsupported "weak-2.c" -} else { - unresolved "weak-2.c" -} - -########### -# alias-1.c -########### - -dg-init -switch [check_alias_available "$srcdir/$subdir/alias-1.c"] { - yes { dg-runtest "$srcdir/$subdir/alias-1.c" "" "" } - no { unsupported "alias-1.c" } - default { fail "alias-1.c" } -} -dg-finish - -########### -# alias-2.c -########### - -dg-init -switch [check_alias_available "$srcdir/$subdir/alias-2.c"] { - yes { dg-runtest "$srcdir/$subdir/alias-2.c" "" "" } - no { unsupported "alias-2.c" } - default { fail "alias-2.c" } -} -dg-finish - -########### -# wkali-1.c -########### - -if { [ check_weak_available ] == 1 } { - dg-init - switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] { - yes { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" } - no { unsupported "wkali-1.c" } - default { fail "wkali-1.c" } - } - dg-finish -} elseif { [ check_weak_available ] == 0 } { - unsupported "wkali-1.c" -} else { - unresolved "wkali-1.c" -} - -########### -# wkali-2.c -########### - -if { [ check_weak_available ] == 1 } { - dg-init - set lines [gcc_target_compile "$srcdir/$subdir/wkali-2a.c" "wkali-2a.o" object ""] - if ![string match "" $lines] then { - fail "wkali-2a.o" - } else { - set lines [gcc_target_compile "$srcdir/$subdir/wkali-2b.c" "wkali-2b.o" object ""] - if [string match "*only weak aliases*" $lines] then { - xfail "wkali-2b.o" - file delete $srcdir/$subdir/wkali-2.exe - } elseif ![string match "" $lines] then { - fail "wkali-2b.o" - } else { - dg-runtest "$srcdir/$subdir/wkali-2.c" "wkali-2a.o wkali-2b.o" "" - file delete wkali-2a.o wkali-2b.o - } - } - dg-finish -} elseif { [ check_weak_available ] == 0 } { - unsupported "wkali-2.c" -} else { - unresolved "wkali-2.c" -} - -########### -# gcsec-1.c -########### - -# Check if the ld used by gcc supports --gc-sections. -set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0] -set ld_output [remote_exec host "$gcc_ld" "--help"] - -# AIX gld supports garbage collection. But AIX gcc does not support -# -ffunction-sections or -fdata-sections. -if { [ string first "--gc-sections" $ld_output ] >= 0 - && ! [istarget rs6000-*-aix*] - && ! [istarget powerpc*-*-aix*] } { - - dg-init - if [isnative] { - dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" "" - } else { - dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" "" - } - dg-finish -} else { - unsupported "gcsec-1.c" -} - -### EOF ecos.exp diff --git a/gcc/testsuite/gcc.dg/special/gcsec-1.c b/gcc/testsuite/gcc.dg/special/gcsec-1.c index 125ae1f218b..f2a63d1b520 100644 --- a/gcc/testsuite/gcc.dg/special/gcsec-1.c +++ b/gcc/testsuite/gcc.dg/special/gcsec-1.c @@ -1,4 +1,10 @@ -/* { dg-do run } */ +/* AIX gld supports garbage collection. But AIX gcc does not support + -ffunction-sections or -fdata-sections. */ +/* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */ +/* { dg-require-gc-sections "" } */ + +/* { dg-options "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" } */ +/* { dg-options "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" { target native } } */ #include diff --git a/gcc/testsuite/gcc.dg/special/special.exp b/gcc/testsuite/gcc.dg/special/special.exp index 25c441204fb..d661e053df6 100644 --- a/gcc/testsuite/gcc.dg/special/special.exp +++ b/gcc/testsuite/gcc.dg/special/special.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. # 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 @@ -24,17 +24,9 @@ # Load support procs. load_lib gcc-dg.exp -############## -# 20000419-2.c -############## - dg-init -switch [check_alias_available "$srcdir/$subdir/20000419-2.c"] { - yes { dg-runtest "$srcdir/$subdir/20000419-2.c" "" "" } - no { unsupported "20000419-2.c" } - default { fail "20000419-2.c" } -} +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*\[1-9\].c]] \ + "" "" dg-finish - ### EOF special.exp diff --git a/gcc/testsuite/gcc.dg/special/weak-1.c b/gcc/testsuite/gcc.dg/special/weak-1.c index fa02f22ace3..b7fb909716a 100644 --- a/gcc/testsuite/gcc.dg/special/weak-1.c +++ b/gcc/testsuite/gcc.dg/special/weak-1.c @@ -1,4 +1,6 @@ /* { dg-do run } */ +/* { dg-require-weak "" } */ +/* { dg-additional-sources weak-1a.c } */ #include diff --git a/gcc/testsuite/gcc.dg/special/weak-2.c b/gcc/testsuite/gcc.dg/special/weak-2.c index b51ba8373e0..bc481430eb5 100644 --- a/gcc/testsuite/gcc.dg/special/weak-2.c +++ b/gcc/testsuite/gcc.dg/special/weak-2.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-additional-sources "weak-2a.c weak-2b.c" } */ #include diff --git a/gcc/testsuite/gcc.dg/special/wkali-1.c b/gcc/testsuite/gcc.dg/special/wkali-1.c index f28d40b9795..9d97b8e1288 100644 --- a/gcc/testsuite/gcc.dg/special/wkali-1.c +++ b/gcc/testsuite/gcc.dg/special/wkali-1.c @@ -1,4 +1,6 @@ /* { dg-do link } */ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ #include diff --git a/gcc/testsuite/gcc.dg/special/wkali-2.c b/gcc/testsuite/gcc.dg/special/wkali-2.c index b51ba8373e0..b53d4f27024 100644 --- a/gcc/testsuite/gcc.dg/special/wkali-2.c +++ b/gcc/testsuite/gcc.dg/special/wkali-2.c @@ -1,4 +1,6 @@ /* { dg-do run } */ +/* { dg-require-weak "" } */ +/* { dg-additional-sources "wkali-2a.c wkali-2b.c" } */ #include diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp index 9f6364576a0..1efb93d4272 100644 --- a/gcc/testsuite/lib/g++-dg.exp +++ b/gcc/testsuite/lib/g++-dg.exp @@ -26,20 +26,3 @@ proc g++-dg-test { prog do_what extra_tool_flags } { proc g++-dg-prune { system text } { return [gcc-dg-prune $system $text] } - -# Record additional sources files that must be compiled along with the -# main source file. - -proc dg-gpp-additional-sources { args } { - global additional_sources - set additional_sources [lindex $args 1] -} - -# Record additional files -- other than source files -- that must be -# present on the system where the compiler runs. - -proc dg-gpp-additional-files { args } { - global additional_files - set additional_files [lindex $args 1] -} - diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 68b4d16023e..821c3d7c758 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -31,8 +31,6 @@ load_lib gcc-defs.exp set gpp_compile_options "" -set additional_sources "" -set additional_files "" # # g++_version -- extract and print the version number of the compiler @@ -306,34 +304,10 @@ proc g++_target_compile { source dest type options } { exec rm -f $rponame } - global additional_sources - global additional_files - set to_download "" - if { $additional_sources != "" } then { - if [is_remote host] { - lappend options "additional_flags=$additional_sources" - } - regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources - if ![is_remote host] { - lappend options "additional_flags=$additional_sources" - } - set to_download [concat $to_download $additional_sources] - } - if { $additional_files != "" } then { - regsub -all " " $additional_files " [file dirname $source]/" additional_files - set to_download [concat $to_download $additional_files] - } - if [is_remote host] { - foreach file $to_download { - remote_download host $file - } - } + set options [dg-additional-files-options $options $source] set result [target_compile $source $dest $type $options] - set additional_sources "" - set additional_files "" - return $result } diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp index 30e4b13ff29..bb2369c2110 100644 --- a/gcc/testsuite/lib/gcc-defs.exp +++ b/gcc/testsuite/lib/gcc-defs.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. # 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 @@ -164,3 +164,56 @@ if { [info procs runtest_file_p] == "" } then { return 1 } } + +# Record additional sources files that must be compiled along with the +# main source file. + +set additional_sources "" + +proc dg-additional-sources { args } { + global additional_sources + set additional_sources [lindex $args 1] +} + +# Record additional files -- other than source files -- that must be +# present on the system where the compiler runs. + +set additional_files "" + +proc dg-additional-files { args } { + global additional_files + set additional_files [lindex $args 1] +} + +# Return an updated version of OPTIONS that mentions any additional +# source files registered with dg-additional-sources. SOURCE is the +# name of the test case. + +proc dg-additional-files-options { options source } { + global additional_sources + global additional_files + set to_download [list] + if { $additional_sources != "" } then { + if [is_remote host] { + lappend options "additional_flags=$additional_sources" + } + regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources + if ![is_remote host] { + lappend options "additional_flags=$additional_sources" + } + set to_download [concat $to_download $additional_sources] + set additional_sources "" + } + if { $additional_files != "" } then { + regsub -all " " $additional_files " [file dirname $source]/" additional_files + set to_download [concat $to_download $additional_files] + set additional_files "" + } + if [is_remote host] { + foreach file $to_download { + remote_download host $file + } + } + + return $options +} diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index f01cd8aede1..09fd618d90a 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -250,3 +250,47 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { } } } + +# If this target does not support weak symbols, skip this test. + +proc dg-require-weak { args } { + upvar dg-do-what dg-do-what + upvar name name + + set weak_available [ check_weak_available ] + if { $weak_available == -1 } { + unresolved "$name" + } + if { $weak_available != 1 } { + set dg-do-what [list [lindex $dg_do_what 0] "N" "P"] + return + } +} + +# If this target does not support the "alias" attribute, skip this +# test. + +proc dg-require-alias { args } { + upvar dg-do-what dg-do-what + upvar name name + + set alias_available [ check_alias_available ] + if { $alias_available == -1 } { + unresolved "$name" + } + if { $alias_available < 2 } { + set dg-do-what [list [lindex $dg_do_what 0] "N" "P"] + return + } +} + +# If this target's linker does not support the --gc-sections flag, +# skip this test. + +proc dg-require-gc-sections { args } { + if { ![ check_gc_sections_available ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex $dg_do_what 0] "N" "P"] + return + } +} diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index f090cb11f49..bec0e2e4258 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # 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 @@ -153,5 +153,6 @@ proc gcc_target_compile { source dest type options } { lappend options "timeout=[target_info gcc,timeout]" } lappend options "compiler=$GCC_UNDER_TEST" + set options [dg-additional-files-options $options $source] return [target_compile $source $dest $type $options] } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index efcc941c220..0944777c9d2 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc. # 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 @@ -67,24 +67,28 @@ proc check_weak_available { } { ############################### # Determine if the target toolchain supports the alias attribute. -# Parameter is the pathname of a file that can be used to test the alias support. -# Returns yes if it does. -# Returns no if it does not. -# Returns dontknow if something went wrong -# For an example of the use of this function, see gcc.dg/special/ecos.exp -proc check_alias_available { testfile } { +# Returns 2 if the target supports aliases. Returns 1 if the target +# only supports weak aliased. Returns 0 if the target does not +# support aliases at all. Returns -1 if support for aliases could not +# be determined. + +proc check_alias_available { } { global alias_available_saved if [info exists alias_available_saved] { verbose "check_alias_available returning saved $alias_available_saved" 2 } else { - verbose "check_alias_available compiling testfile $testfile" 2 - set lines [gcc_target_compile $testfile "tmp.o" object ""] - + verbose "check_alias_available compiling testfile" 2 + set f [open "tmp.c" "w"] + puts $f "void f() __attribute__((alias(\"g\")));" + close $f + set lines [gcc_target_compile "tmp.c" "tmp.o" object ""] + file delete "tmp.c" + if [string match "" $lines] then { # No error messages, everything is OK. - set alias_available_saved yes + set alias_available_saved 2 } else { if [regexp "alias definitions not supported" $lines] { verbose "check_alias_available target does not support aliases" 2 @@ -93,16 +97,16 @@ proc check_alias_available { testfile } { if { $objformat == "elf" } { verbose "check_alias_available but target uses ELF format, so it ought to" 2 - set alias_available_saved dontknow + set alias_available_saved -1 } else { - set alias_available_saved no + set alias_available_saved 0 } } else { if [regexp "only weak aliases are supported" $lines] { verbose "check_alias_available target supports only weak aliases" 2 - set alias_available_saved no + set alias_available_saved 1 } else { - set alias_available_saved dontknow + set alias_available_saved -1 } } } @@ -112,3 +116,21 @@ proc check_alias_available { testfile } { return $alias_available_saved } + +# Returns true if --gc-sections is supported on the target. + +proc check_gc_sections_available { } { + global gc_sections_available_saved + + if {![info exists alias_available_saved]} { + # Check if the ld used by gcc supports --gc-sections. + set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0] + set ld_output [remote_exec host "$gcc_ld" "--help"] + if { [ string first "--gc-sections" $ld_output ] >= 0 } { + set gc_sections_available_saved 1 + } else { + set gc_sections_available_saved 0 + } + } + return $gc_sections_available_saved +}