From d2f3722fe17b121dbf7d5afaa3b1e8c4d4721bfa Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 9 Nov 2011 17:53:53 +0000 Subject: Run most tests in both C++98 and C++11 modes. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_c++11): New. (check_effective_target_c++98): New. * lib/g++-dg.exp (g++-dg-runtest): New. * [various.exp]: Use g++-dg-runtest. * [various.C]: Fix for C++11 mode. gcc/cp/ * Make-lang.in (check_g++_parallelize): Add dg-torture.exp. (check-c++0x): Obsolete. / * Makefile.def (language=c++): Remove check-c++0x. * Makefile.in (check-gcc-c++): Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181222 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.dg/abi/mangle4.C | 24 ---------------------- gcc/testsuite/g++.dg/charset/charset.exp | 4 ++-- gcc/testsuite/g++.dg/cpp0x/variadic60.C | 2 +- gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp | 4 ++-- gcc/testsuite/g++.dg/dfp/dfp.exp | 8 ++++---- gcc/testsuite/g++.dg/dg.exp | 12 +++++------ gcc/testsuite/g++.dg/ext/anon-struct4.C | 2 +- gcc/testsuite/g++.dg/gcov/gcov.exp | 2 +- gcc/testsuite/g++.dg/gomp/gomp.exp | 2 +- gcc/testsuite/g++.dg/graphite/graphite.exp | 12 +++++------ gcc/testsuite/g++.dg/init/brace2.C | 2 +- gcc/testsuite/g++.dg/init/brace6.C | 2 +- gcc/testsuite/g++.dg/init/null1.C | 3 ++- gcc/testsuite/g++.dg/other/anon3.C | 2 +- .../g++.dg/simulate-thread/simulate-thread.exp | 4 ++-- gcc/testsuite/g++.dg/template/arg2.C | 2 +- gcc/testsuite/g++.dg/template/nontype25.C | 22 ++++++++++++++++++++ gcc/testsuite/g++.dg/template/sfinae6_neg.C | 2 +- gcc/testsuite/g++.dg/tls/tls.exp | 4 ++-- gcc/testsuite/g++.dg/tm/tm.exp | 10 ++++----- gcc/testsuite/g++.dg/vect/vect.exp | 12 +++++------ gcc/testsuite/g++.dg/warn/Wconversion-null-3.C | 1 + 22 files changed, 69 insertions(+), 69 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/abi/mangle4.C create mode 100644 gcc/testsuite/g++.dg/template/nontype25.C (limited to 'gcc/testsuite/g++.dg') diff --git a/gcc/testsuite/g++.dg/abi/mangle4.C b/gcc/testsuite/g++.dg/abi/mangle4.C deleted file mode 100644 index 3ce224716db..00000000000 --- a/gcc/testsuite/g++.dg/abi/mangle4.C +++ /dev/null @@ -1,24 +0,0 @@ -// Test mangling of type casts -// { dg-do compile } - -class A {}; -class B : public A {}; - -template class C {}; -template class D {}; -template class E {}; - -template void f(D &, C(b)> &) {} // { dg-error "" } -template void g(D &, E(b)> &) {} // { dg-error "" } - -B b; - -int main() -{ - C(&b)> c; // { dg-error "" } - D<&b> d; - E(&b)> e; // { dg-error "" } - f(d, c); - g(d, e); -} - diff --git a/gcc/testsuite/g++.dg/charset/charset.exp b/gcc/testsuite/g++.dg/charset/charset.exp index 7d409d336ac..fe35f6a4403 100644 --- a/gcc/testsuite/g++.dg/charset/charset.exp +++ b/gcc/testsuite/g++.dg/charset/charset.exp @@ -37,8 +37,8 @@ if ![info exists DEFAULT_CHARSETCFLAGS] then { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \ - "" $DEFAULT_CHARSETCFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \ + $DEFAULT_CHARSETCFLAGS # All done. dg-finish diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic60.C b/gcc/testsuite/g++.dg/cpp0x/variadic60.C index b86711ff66b..8e1681eecc0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic60.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic60.C @@ -1 +1 @@ -template class tuple; // { dg-error "variadic templates" } +template class tuple; // { dg-error "variadic templates" "" { target c++98 } } diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp index 37dd794bed4..7b112ac6001 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp +++ b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp @@ -35,8 +35,8 @@ set comp_output [g++_target_compile \ if { ! [string match "*: target system does not support the * debug format*" \ $comp_output] } { remove-build-file "trivial.S" - dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/dwarf2/*.c]] \ - "" $DEFAULT_CFLAGS + g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/dwarf2/*.c]] \ + $DEFAULT_CFLAGS } # All done. diff --git a/gcc/testsuite/g++.dg/dfp/dfp.exp b/gcc/testsuite/g++.dg/dfp/dfp.exp index 4b15ca529b5..4d235e5c084 100644 --- a/gcc/testsuite/g++.dg/dfp/dfp.exp +++ b/gcc/testsuite/g++.dg/dfp/dfp.exp @@ -49,11 +49,11 @@ set DEFAULT_CXXFLAGS "" dg-init # Main loop. Run the tests that are specific to C++. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[C]] \ - "" $DEFAULT_CXXFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[C]] \ + $DEFAULT_CXXFLAGS # Run tests that are shared with C testing. -dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/dfp/*.c]] \ - "" $DEFAULT_CXXFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/dfp/*.c]] \ + $DEFAULT_CXXFLAGS # All done. dg-finish diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp index ad1f7e23700..0730c76e820 100644 --- a/gcc/testsuite/g++.dg/dg.exp +++ b/gcc/testsuite/g++.dg/dg.exp @@ -22,7 +22,7 @@ load_lib g++-dg.exp # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { - set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long" + set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long" } # Initialize `dg'. @@ -52,14 +52,14 @@ set tests [prune $tests $srcdir/$subdir/guality/*] set tests [prune $tests $srcdir/$subdir/simulate-thread/*] # Main loop. -dg-runtest $tests "" $DEFAULT_CXXFLAGS +g++-dg-runtest $tests $DEFAULT_CXXFLAGS # C/C++ common tests. -dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \ - "" "" +g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \ + "" -dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cpp/*.\[cS\]]] \ - "" "" +g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cpp/*.\[cS\]]] \ + "" # All done. diff --git a/gcc/testsuite/g++.dg/ext/anon-struct4.C b/gcc/testsuite/g++.dg/ext/anon-struct4.C index fa5bd4b3d8a..5d0bf71ae63 100644 --- a/gcc/testsuite/g++.dg/ext/anon-struct4.C +++ b/gcc/testsuite/g++.dg/ext/anon-struct4.C @@ -1,5 +1,5 @@ // PR c++/14401 struct { struct { int& i ; } bar ; } foo ; // { dg-error "uninitialized" "uninit" } -// { dg-warning "anonymous" "anon" { target *-*-* } 3 } +// { dg-warning "anonymous" "anon" { target c++98 } 3 } // { dg-message "should be initialized" "ref-uninit" { target *-*-* } 3 } diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 08e00c45d55..73703dcaf91 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -39,6 +39,6 @@ if { $files != "" } { } # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" "" +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" dg-finish diff --git a/gcc/testsuite/g++.dg/gomp/gomp.exp b/gcc/testsuite/g++.dg/gomp/gomp.exp index b99d302ddf5..445cea89983 100644 --- a/gcc/testsuite/g++.dg/gomp/gomp.exp +++ b/gcc/testsuite/g++.dg/gomp/gomp.exp @@ -27,7 +27,7 @@ if ![check_effective_target_fopenmp] { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/gomp/*.c]] "" "-fopenmp" +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/gomp/*.c]] "-fopenmp" # All done. dg-finish diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp index 4b359c9b3ce..7c96f58c70d 100644 --- a/gcc/testsuite/g++.dg/graphite/graphite.exp +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -46,14 +46,14 @@ set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.C ] ] # Tests to be compiled. set dg-do-what-default compile -dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" -dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" +g++-dg-runtest $scop_files "-O2 -fgraphite -fdump-tree-graphite-all" +g++-dg-runtest $id_files "-O2 -fgraphite-identity -ffast-math" # Tests to be run. set dg-do-what-default run -dg-runtest $run_id_files "" "-O2 -fgraphite-identity" -dg-runtest $interchange_files "" "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" -dg-runtest $block_files "" "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" +g++-dg-runtest $run_id_files "-O2 -fgraphite-identity" +g++-dg-runtest $interchange_files "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" +g++-dg-runtest $block_files "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" # The default action for the rest of the files is 'compile'. set dg-do-what-default compile @@ -62,7 +62,7 @@ foreach f $id_files {lremove wait_to_run_files $f} foreach f $run_id_files {lremove wait_to_run_files $f} foreach f $interchange_files {lremove wait_to_run_files $f} foreach f $block_files {lremove wait_to_run_files $f} -dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors" +g++-dg-runtest $wait_to_run_files " -pedantic-errors" # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/g++.dg/init/brace2.C b/gcc/testsuite/g++.dg/init/brace2.C index 619a20f3c70..fec9c6ce4d7 100644 --- a/gcc/testsuite/g++.dg/init/brace2.C +++ b/gcc/testsuite/g++.dg/init/brace2.C @@ -5,4 +5,4 @@ const char * y = { "hello" }; int a = 2; int b = { 2,3 }; // { dg-error "requires one element in initializer" } int c = { { 2 } } ; // { dg-error "braces around scalar initializer" } -int d = {}; // { dg-error "initializer" } +int d = {}; // { dg-error "initializer" "" { target c++98 } } diff --git a/gcc/testsuite/g++.dg/init/brace6.C b/gcc/testsuite/g++.dg/init/brace6.C index e01b947429f..ca39b0180d0 100644 --- a/gcc/testsuite/g++.dg/init/brace6.C +++ b/gcc/testsuite/g++.dg/init/brace6.C @@ -18,7 +18,7 @@ int main() { int i = { 1 }; int j = { 1, 2 }; /* { dg-error "requires one element" } */ - A a = { 6 }; /* { dg-error "initialize" } */ + A a = { 6 }; /* { dg-error "initialize" "" { target c++98 } } */ B b = { 6 }; /* { dg-error "" } */ C c = { 6 }; /* { dg-error "too many initializers" } */ D d = { 6 }; diff --git a/gcc/testsuite/g++.dg/init/null1.C b/gcc/testsuite/g++.dg/init/null1.C index eff3f610968..a76ae2a2574 100644 --- a/gcc/testsuite/g++.dg/init/null1.C +++ b/gcc/testsuite/g++.dg/init/null1.C @@ -1,6 +1,7 @@ // PR c++/16489 +// { dg-do compile { target c++98 } } const int NULL = 0; int main() { - double* p = NULL; + double* p = NULL; } diff --git a/gcc/testsuite/g++.dg/other/anon3.C b/gcc/testsuite/g++.dg/other/anon3.C index 87116eb8901..707c2d58f9d 100644 --- a/gcc/testsuite/g++.dg/other/anon3.C +++ b/gcc/testsuite/g++.dg/other/anon3.C @@ -4,4 +4,4 @@ // { dg-do compile } -enum { a = 3 } x; // { dg-warning "anonymous type" } +enum { a = 3 } x; // { dg-warning "anonymous type" "" { target c++98 } } diff --git a/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp b/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp index f9e6475c054..01e4aaf63cf 100644 --- a/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp +++ b/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp @@ -26,8 +26,8 @@ torture-init set-torture-options [list \ { -O0 -g } \ { -O1 -g } \ - { -O2 -g } \ - { -O3 -g } \ + { -O2 -g -std=c++98 } \ + { -O3 -g -std=c++11 } \ { -Os -g } ] if [gdb-exists] { diff --git a/gcc/testsuite/g++.dg/template/arg2.C b/gcc/testsuite/g++.dg/template/arg2.C index 9fb7a68cc78..dabefc8778f 100644 --- a/gcc/testsuite/g++.dg/template/arg2.C +++ b/gcc/testsuite/g++.dg/template/arg2.C @@ -10,5 +10,5 @@ template class X {}; void fn () { class L {}; - X f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" } + X f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" { target c++98 } } } diff --git a/gcc/testsuite/g++.dg/template/nontype25.C b/gcc/testsuite/g++.dg/template/nontype25.C new file mode 100644 index 00000000000..bcdcce5ea9b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nontype25.C @@ -0,0 +1,22 @@ +// { dg-do compile } + +class A {}; +class B : public A {}; + +template class C {}; +template class D {}; +template class E {}; + +template void f(D &, C(b)> &) {} // { dg-error "" "" { target c++98 } } +template void g(D &, E(b)> &) {} // { dg-error "" "" { target c++98 } } + +B b; + +int main() +{ + C(&b)> c; // { dg-error "" } + D<&b> d; + E(&b)> e; // { dg-error "" "" { target c++98 } } + f(d, c); // { dg-error "" "" { target c++11 } } + g(d, e); +} diff --git a/gcc/testsuite/g++.dg/template/sfinae6_neg.C b/gcc/testsuite/g++.dg/template/sfinae6_neg.C index 2df4ade4720..d4be5dd03f0 100644 --- a/gcc/testsuite/g++.dg/template/sfinae6_neg.C +++ b/gcc/testsuite/g++.dg/template/sfinae6_neg.C @@ -14,7 +14,7 @@ template struct enable_if { }; template typename enable_if()(create_a(), create_a()), 1), yes_type>::type - check_is_callable2(type, type, type); + check_is_callable2(type, type, type); // { dg-error "within this context" "" { target c++11 } } no_type check_is_callable2(...); diff --git a/gcc/testsuite/g++.dg/tls/tls.exp b/gcc/testsuite/g++.dg/tls/tls.exp index 6450ea34f9b..7745cd52da4 100644 --- a/gcc/testsuite/g++.dg/tls/tls.exp +++ b/gcc/testsuite/g++.dg/tls/tls.exp @@ -22,14 +22,14 @@ load_lib g++-dg.exp # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { - set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long" + set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long" } # Initialize `dg'. dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $DEFAULT_CXXFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $DEFAULT_CXXFLAGS # All done. dg-finish diff --git a/gcc/testsuite/g++.dg/tm/tm.exp b/gcc/testsuite/g++.dg/tm/tm.exp index d8c76fe1e88..df40cdc1349 100644 --- a/gcc/testsuite/g++.dg/tm/tm.exp +++ b/gcc/testsuite/g++.dg/tm/tm.exp @@ -22,18 +22,18 @@ load_lib g++-dg.exp # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { - set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long" + set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long" } # Initialize `dg'. dg-init # Run the tests that are shared with C. -dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/tm/*.c]] \ - "" $DEFAULT_CXXFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/tm/*.c]] \ + $DEFAULT_CXXFLAGS # Run the C++ only tests. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \ - "" $DEFAULT_CXXFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \ + $DEFAULT_CXXFLAGS # All done. dg-finish diff --git a/gcc/testsuite/g++.dg/vect/vect.exp b/gcc/testsuite/g++.dg/vect/vect.exp index 76bd99a9862..7cb02d026fe 100644 --- a/gcc/testsuite/g++.dg/vect/vect.exp +++ b/gcc/testsuite/g++.dg/vect/vect.exp @@ -58,10 +58,10 @@ lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \ - "" $DEFAULT_VECTCFLAGS -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \ - "" $VECT_SLP_CFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \ + $DEFAULT_VECTCFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \ + $VECT_SLP_CFLAGS #### Tests with special options global SAVED_DEFAULT_VECTCFLAGS @@ -70,8 +70,8 @@ set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS # --param max-aliased-vops=0 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \ - "" $DEFAULT_VECTCFLAGS +g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \ + $DEFAULT_VECTCFLAGS # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C index 1942ee270bf..644ae1c40da 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C @@ -1,4 +1,5 @@ // PR c++/48420 +// { dg-do compile { target c++98 } } void foo(int* p); -- cgit v1.2.1