From: Mark Mitchell Date: Mon, 12 May 2003 15:24:31 +0000 (+0000) Subject: g++.exp: Tweak handling of additional source files. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc7c7ad6bcf9ba652c350f7c27f6a1181440d9eb;p=gcc.git g++.exp: Tweak handling of additional source files. * lib/g++.exp: Tweak handling of additional source files. * g++.dg/special/conpr-2.C: Use dg-gpp-additional-sources. * g++.dg/special/conpr-2a.C: Rename to ... * g++.dg/special/conpr-2a.cc: ... this. * g++.dg/special/conpr-3.C: Use dg-gpp-additional-sources. * g++.dg/special/conpr-3a.C: Rename to ... * g++.dg/special/conpr-3a.cc: This. * g++.dg/special/conpr-3b.C: Rename to ... * g++.dg/special/conpr-3b.cc: This. * g++.dg/special/conpr-4.C: New test. * g++.dg/special/ecos.exp: Rewrite to use ordinary dg driver. From-SVN: r66721 --- diff --git a/gcc/testsuite/g++.dg/special/conpr-2.C b/gcc/testsuite/g++.dg/special/conpr-2.C index 2deeb011d6b..9c482b95fb6 100644 --- a/gcc/testsuite/g++.dg/special/conpr-2.C +++ b/gcc/testsuite/g++.dg/special/conpr-2.C @@ -1,5 +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" } */ #include diff --git a/gcc/testsuite/g++.dg/special/conpr-2a.C b/gcc/testsuite/g++.dg/special/conpr-2a.C deleted file mode 100644 index 69fb7d64831..00000000000 --- a/gcc/testsuite/g++.dg/special/conpr-2a.C +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do run } */ - -class foo_t { - int x; - static int count; -public: - foo_t(void) { x=++count; } - int get(void) { return x; } -}; - -foo_t foo1 __attribute__((init_priority(6000))); -foo_t foo2 __attribute__((init_priority(5000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-2a.cc b/gcc/testsuite/g++.dg/special/conpr-2a.cc new file mode 100644 index 00000000000..69fb7d64831 --- /dev/null +++ b/gcc/testsuite/g++.dg/special/conpr-2a.cc @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +class foo_t { + int x; + static int count; +public: + foo_t(void) { x=++count; } + int get(void) { return x; } +}; + +foo_t foo1 __attribute__((init_priority(6000))); +foo_t foo2 __attribute__((init_priority(5000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-3.C b/gcc/testsuite/g++.dg/special/conpr-3.C index c5fc235e779..3fe5741f546 100644 --- a/gcc/testsuite/g++.dg/special/conpr-3.C +++ b/gcc/testsuite/g++.dg/special/conpr-3.C @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-gpp-additional-sources "conpr-3a.cc conpr-3b.cc" } */ #include diff --git a/gcc/testsuite/g++.dg/special/conpr-3a.C b/gcc/testsuite/g++.dg/special/conpr-3a.C deleted file mode 100644 index b237bb57f36..00000000000 --- a/gcc/testsuite/g++.dg/special/conpr-3a.C +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do run } */ - -class foo_t { - int x; - static int count; -public: - foo_t(void) { x=++count; } - int get(void) { return x; } -}; - -foo_t foo1 __attribute__((init_priority(6000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-3a.cc b/gcc/testsuite/g++.dg/special/conpr-3a.cc new file mode 100644 index 00000000000..b237bb57f36 --- /dev/null +++ b/gcc/testsuite/g++.dg/special/conpr-3a.cc @@ -0,0 +1,11 @@ +/* { dg-do run } */ + +class foo_t { + int x; + static int count; +public: + foo_t(void) { x=++count; } + int get(void) { return x; } +}; + +foo_t foo1 __attribute__((init_priority(6000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-3b.C b/gcc/testsuite/g++.dg/special/conpr-3b.C deleted file mode 100644 index b5efa0c35f6..00000000000 --- a/gcc/testsuite/g++.dg/special/conpr-3b.C +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do run } */ - -class foo_t { - int x; - static int count; -public: - foo_t(void) { x=++count; } - int get(void) { return x; } -}; - -foo_t foo2 __attribute__((init_priority(5000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-3b.cc b/gcc/testsuite/g++.dg/special/conpr-3b.cc new file mode 100644 index 00000000000..b5efa0c35f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/special/conpr-3b.cc @@ -0,0 +1,11 @@ +/* { dg-do run } */ + +class foo_t { + int x; + static int count; +public: + foo_t(void) { x=++count; } + int get(void) { return x; } +}; + +foo_t foo2 __attribute__((init_priority(5000))); diff --git a/gcc/testsuite/g++.dg/special/conpr-4.C b/gcc/testsuite/g++.dg/special/conpr-4.C new file mode 100644 index 00000000000..68ac543ad1c --- /dev/null +++ b/gcc/testsuite/g++.dg/special/conpr-4.C @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-gpp-additional-sources "conpr-3b.cc conpr-3a.cc" } */ + +#include + +class foo_t { + int x; + static int count; +public: + foo_t(void) { x=++count; } + int get(void) { return x; } +}; + +int foo_t::count; + +extern foo_t foo1, foo2; + +int main(void) { + + if ( (foo1.get() != 2) || (foo2.get() != 1) ) + abort(); + exit(0); +} diff --git a/gcc/testsuite/g++.dg/special/ecos.exp b/gcc/testsuite/g++.dg/special/ecos.exp index 0a9eff9ff8b..dc34ff83da4 100644 --- a/gcc/testsuite/g++.dg/special/ecos.exp +++ b/gcc/testsuite/g++.dg/special/ecos.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 @@ -24,85 +24,21 @@ # Load support procs. load_lib g++-dg.exp -########### -# conpr-1.C -########### +# Test for whether or not __attribute__((init_priority)) is supported +# by the platform. -dg-init -set lines [g++_target_compile "$srcdir/$subdir/conpr-1.C" "$objdir/conpr-1.exe" executable ""] -if [string match "*init_priority*" $lines] then { - xfail "conpr-1.C" - file delete $objdir/conpr-1.exe -} elseif ![string match "" $lines] then { - fail "conpr-1.C" -} else { - dg-runtest "$srcdir/$subdir/conpr-1.C" "" "" - file delete $objdir/conpr-1.exe +set comp_output [g++_target_compile \ + "$srcdir/$subdir/initp1.C" "initp1.S" assembly ""] +if { [string match "*init_priority*" $comp_output] } { + return 0 } -dg-finish - - -########### -# conpr-2.C -########### +# Initialize 'dg'. dg-init -set lines [g++_target_compile "$srcdir/$subdir/conpr-2a.C" "conpr-2a.o" object ""] -if [string match "*init_priority*" $lines] then { - xfail "conpr-2a.o" -} elseif ![string match "" $lines] then { - fail "conpr-2a.o" -} else { - dg-runtest "$srcdir/$subdir/conpr-2.C" "conpr-2a.o" "" - file delete conpr-2a.o -} -dg-finish - +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" "" -########### -# conpr-3.C -########### - -dg-init - -set lines [g++_target_compile "$srcdir/$subdir/conpr-3a.C" "conpr-3a.o" object ""] -if [string match "*init_priority*" $lines] then { - xfail "conpr-3a.o" -} elseif ![string match "" $lines] then { - fail "conpr-3a.o" -} else { - set lines [g++_target_compile "$srcdir/$subdir/conpr-3b.C" "conpr-3b.o" object ""] - if ![string match "" $lines] then { - fail "conpr-3b.o" - } else { - # run it with objects both ways around! - # This doesn't work on solaris2 for reasons described in PR 6482. - if { ![regexp ".*-solaris2.*" $target_triplet] } { - dg-runtest "$srcdir/$subdir/conpr-3.C" "conpr-3a.o conpr-3b.o" "" - dg-runtest "$srcdir/$subdir/conpr-3.C" "conpr-3b.o conpr-3a.o" "" - } - file delete conpr-3a.o conpr-3b.o - } -} -dg-finish - -########### -# initp1.C -########### - -dg-init -set lines [g++_target_compile "$srcdir/$subdir/initp1.C" "$objdir/initp1.exe" executable ""] -if [string match "*init_priority*" $lines] then { - xfail "initp1.C" - file delete $objdir/initp1.exe -} elseif ![string match "" $lines] then { - fail "initp1.C" -} else { - dg-runtest "$srcdir/$subdir/initp1.C" "" "" - file delete $objdir/initp1.exe -} +# All done. dg-finish - -### EOF ecos.exp diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 63808f87c77..68b4d16023e 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -313,7 +313,7 @@ proc g++_target_compile { source dest type options } { if [is_remote host] { lappend options "additional_flags=$additional_sources" } - regsub -all " " $additional_sources " [file dirname $source]/" additional_sources + regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources if ![is_remote host] { lappend options "additional_flags=$additional_sources" }