diff options
51 files changed, 197 insertions, 100 deletions
@@ -1,3 +1,8 @@ +2011-11-09 Jason Merrill <jason@redhat.com> + + * Makefile.def (language=c++): Remove check-c++0x. + * Makefile.in (check-gcc-c++): Regenerate. + 2011-11-08 Richard Henderson <rth@redhat.com> * configure.ac: Test for libitm directory present first. diff --git a/Makefile.def b/Makefile.def index b94dabf..b4236ba 100644 --- a/Makefile.def +++ b/Makefile.def @@ -513,7 +513,7 @@ dependencies = { module=configure-target-newlib; on=all-ld; }; dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; }; languages = { language=c; gcc-check-target=check-gcc; }; -languages = { language=c++; gcc-check-target="check-c++ check-c++0x"; +languages = { language=c++; gcc-check-target=check-c++; lib-check-target=check-target-libstdc++-v3; lib-check-target=check-target-libmudflap-c++; }; languages = { language=fortran; gcc-check-target=check-fortran; diff --git a/Makefile.in b/Makefile.in index 900c325..c377f57 100644 --- a/Makefile.in +++ b/Makefile.in @@ -40661,7 +40661,7 @@ check-gcc-c++: r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++ check-c++0x); + (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); check-c++: check-gcc-c++ check-target-libstdc++-v3 check-target-libmudflap-c++ .PHONY: check-gcc-fortran check-fortran diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 03ffece..cba11e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-11-09 Jason Merrill <jason@redhat.com> + * Make-lang.in (check_g++_parallelize): Add dg-torture.exp. + (check-c++0x): Obsolete. + * pt.c (invalid_nontype_parm_type_p): Avoid printing "<type error>". * pt.c (convert_nontype_argument): Only integral arguments diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 650fc38..0ce01ac 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -152,8 +152,7 @@ c++.srcman: doc/g++.1 check-c++ : check-g++ # Run the testsute in C++0x mode. check-c++0x: - $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,-std=gnu++0x" \ - TESTSUITEDIR="$(TESTSUITEDIR).c++0x" check-g++ + @echo Normal 'make check' now runs the testsuite in C++11 mode as well as C++98. # Run the testsuite with garbage collection at every opportunity. check-g++-strict-gc: $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \ @@ -163,7 +162,7 @@ check-c++-subtargets : check-g++-subtargets lang_checks += check-g++ lang_checks_parallelized += check-g++ # For description see comment above check_gcc_parallelize in gcc/Makefile.in. -check_g++_parallelize = old-deja.exp dg.exp +check_g++_parallelize = old-deja.exp dg.exp dg-torture.exp # # Install hooks: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 737a614..cff301e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,53 @@ -2011-11-09 Jason Merrill <jason@redhat.com> +2011-11-08 Jason Merrill <jason@redhat.com> + + Run most C++ tests in both C++98 and C++11 modes. + * lib/target-supports.exp (check_effective_target_c++11): New. + (check_effective_target_c++98): New. + * lib/g++-dg.exp (g++-dg-runtest): New. + * g++.dg/dg.exp: Use g++-dg-runtest. + * g++.dg/charset/charset.exp: Likewise. + * g++.dg/debug/dwarf2/dwarf2.exp: Likewise. + * g++.dg/dfp/dfp.exp: Likewise. + * g++.dg/gcov/gcov.exp: Likewise. + * g++.dg/gomp/gomp.exp: Likewise. + * g++.dg/graphite/graphite.exp: Likewise. + * g++.dg/tls/tls.exp: Likewise. + * g++.dg/tm/tm.exp: Likewise. + * g++.dg/vect/vect.exp: Likewise. + * g++.old-deja/old-deja.exp: Likewise. + * g++.dg/simulate-thread/simulate-thread.exp: Pass -std flags + with some of the torture options. + * g++.dg/abi/mangle4.C: Move to template/nontype25.C. + * g++.dg/template/sfinae6_neg.C: Add C++11 error. + * g++.dg/init/null1.C: Only run in C++98. + * g++.dg/warn/Wconversion-null-3.C: Likewise. + * g++.old-deja/g++.benjamin/p12475.C: Likewise. + * g++.old-deja/g++.brendan/crash64.C: Likewise. + * g++.old-deja/g++.other/anon9.C: Likewise. + * g++.old-deja/g++.other/linkage1.C: Likewise. + * g++.old-deja/g++.other/linkage2.C: Likewise. + * g++.old-deja/g++.pt/t29.C: Likewise. + * g++.old-deja/g++.pt/t30.C: Likewise. + * g++.dg/cpp0x/variadic60.C: Only error in C++98. + * g++.dg/ext/anon-struct4.C: Likewise. + * g++.dg/init/brace2.C: Likewise. + * g++.dg/init/brace6.C: Likewise. + * g++.dg/other/anon3.C: Likewise. + * g++.dg/template/arg2.C: Likewise. + * g++.old-deja/g++.brendan/cvt1.C: Likewise. + * g++.old-deja/g++.brendan/enum11.C: Likewise. + * g++.old-deja/g++.brendan/enum8.C: Likewise. + * g++.old-deja/g++.brendan/enum9.C: Likewise. + * g++.old-deja/g++.brendan/friend3.C: Likewise. + * g++.old-deja/g++.brendan/init2.C: Likewise. + * g++.old-deja/g++.brendan/init4.C: Likewise. + * g++.old-deja/g++.brendan/misc14.C: Likewise. + * g++.old-deja/g++.jason/cond.C: Likewise. + * g++.old-deja/g++.law/init1.C: Likewise. + * g++.old-deja/g++.law/operators32.C: Likewise. + * g++.old-deja/g++.pt/enum6.C: Likewise. + * g++.old-deja/g++.pt/explicit70.C: Likewise. + * g++.old-deja/g++.pt/ptrmem6.C: Likewise. * g++.dg/eh/new1.C: Adjust for C++11 mode. * g++.dg/init/new11.C: Likewise. diff --git a/gcc/testsuite/g++.dg/charset/charset.exp b/gcc/testsuite/g++.dg/charset/charset.exp index 7d409d3..fe35f6a 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 b86711f..8e1681e 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic60.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic60.C @@ -1 +1 @@ -template<typename... Args> class tuple; // { dg-error "variadic templates" } +template<typename... Args> 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 37dd794..7b112ac 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 4b15ca5..4d235e5 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 ad1f7e2..0730c76 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 fa5bd4b..5d0bf71 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 08e00c4..73703dc 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 b99d302..445cea8 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 4b359c9..7c96f58 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 619a20f..fec9c6c 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 e01b947..ca39b01 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 eff3f61..a76ae2a 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 87116eb..707c2d5 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 f9e6475..01e4aaf 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 9fb7a68..dabefc8 100644 --- a/gcc/testsuite/g++.dg/template/arg2.C +++ b/gcc/testsuite/g++.dg/template/arg2.C @@ -10,5 +10,5 @@ template <typename T> class X {}; void fn () { class L {}; - X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" } + X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" { target c++98 } } } diff --git a/gcc/testsuite/g++.dg/abi/mangle4.C b/gcc/testsuite/g++.dg/template/nontype25.C index 3ce2247..bcdcce5 100644 --- a/gcc/testsuite/g++.dg/abi/mangle4.C +++ b/gcc/testsuite/g++.dg/template/nontype25.C @@ -1,4 +1,3 @@ -// Test mangling of type casts // { dg-do compile } class A {}; @@ -8,8 +7,8 @@ template<const A* a> class C {}; template<const B* b> class D {}; template<B* b> class E {}; -template<const B* b> void f(D<b> &, C<static_cast<const A*>(b)> &) {} // { dg-error "" } -template<const B* b> void g(D<b> &, E<const_cast<B*>(b)> &) {} // { dg-error "" } +template<const B* b> void f(D<b> &, C<static_cast<const A*>(b)> &) {} // { dg-error "" "" { target c++98 } } +template<const B* b> void g(D<b> &, E<const_cast<B*>(b)> &) {} // { dg-error "" "" { target c++98 } } B b; @@ -17,8 +16,7 @@ int main() { C<static_cast<const A*>(&b)> c; // { dg-error "" } D<&b> d; - E<const_cast<B*>(&b)> e; // { dg-error "" } - f(d, c); + E<const_cast<B*>(&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 2df4ade..d4be5dd 100644 --- a/gcc/testsuite/g++.dg/template/sfinae6_neg.C +++ b/gcc/testsuite/g++.dg/template/sfinae6_neg.C @@ -14,7 +14,7 @@ template<typename T> struct enable_if<false, T> { }; template<typename F, typename T1, typename T2> typename enable_if<sizeof(create_a<F>()(create_a<T1>(), create_a<T2>()), 1), yes_type>::type - check_is_callable2(type<F>, type<T1>, type<T2>); + check_is_callable2(type<F>, type<T1>, type<T2>); // { 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 6450ea3..7745cd5 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 d8c76fe..df40cdc 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 76bd99a..7cb02d02 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 1942ee2..644ae1c 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); diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C index d3e121e..d41c26b 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } // prms-id: 12475 #include <limits.h> diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C index 3c98692..5fd31a6a 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } // GROUPS passed old-abort typedef __SIZE_TYPE__ size_t; typedef void (*RF_Ptr)(void *); diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/cvt1.C b/gcc/testsuite/g++.old-deja/g++.brendan/cvt1.C index 1327f5a..544d59b 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/cvt1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/cvt1.C @@ -5,7 +5,7 @@ class Thing { public: - typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma + typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" "comma" { target c++98 } } Thing (ThingType type) : thingType (type) { } ~Thing () { } private: @@ -15,7 +15,7 @@ private: class Group { public: - typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma + typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" "comma" { target c++98 } } Group (GroupType type) : groupType (type), groupCount (0) { } ~Group () { } void append (Thing* const &entry) { groupCount ++ ; } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C index 009333a..9c10560 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C @@ -6,7 +6,7 @@ class X { oneMask = 0x0000FFFF, twoMask = 0x000F0000, - thiMask = 0xFFF00000, // { dg-error "comma at end" } + thiMask = 0xFFF00000, // { dg-error "comma at end" "" { target c++98 } } }; unsigned int foo; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C index ecf6fbf..bbdda4b 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum8.C @@ -6,7 +6,7 @@ class foo1 enum foo1_enum { ENUM1, - ENUM2, // { dg-error "comma at end" } + ENUM2, // { dg-error "comma at end" "" { target c++98 } } }; }; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C index 88ecc73..d8a7d1b 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum9.C @@ -2,7 +2,7 @@ // GROUPS passed enums enum fig { figgy, - pudding, // { dg-error "comma at end" } + pudding, // { dg-error "comma at end" "" { target c++98 } } }; class X { diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C b/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C index ecd85b4..209ea8c 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/friend3.C @@ -5,7 +5,7 @@ class B { friend class A; enum { - bEnum = 1, // { dg-error "comma at end" } + bEnum = 1, // { dg-error "comma at end" "" { target c++98 } } }; int bArray[ bEnum ]; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/init2.C b/gcc/testsuite/g++.old-deja/g++.brendan/init2.C index 0bf0aba..1b376dc 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/init2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/init2.C @@ -2,4 +2,4 @@ // GROUPS passed initialization // this should give an error in require_required_type about not // being allowed to have an initializer list in an argument list. -int f(int a = {1});// { dg-error "" } .* +int f(int a = {1});// { dg-error "" "" { target c++98 } } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/init4.C b/gcc/testsuite/g++.old-deja/g++.brendan/init4.C index aa2bfb6..d3d1ffd 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/init4.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/init4.C @@ -2,4 +2,4 @@ // GROUPS passed initialization struct CharList { int i; }; -const CharList& terminals = { 1 }; // { dg-error "initializer lists" } c++0x +const CharList& terminals = { 1 }; // { dg-error "initializer lists" "" { target c++98 } } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C index 09242a4..d2e4909 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C @@ -4,7 +4,7 @@ class X { public: enum e { New // { dg-error "conflicts with previous" } - , // { dg-error "comma at end" } + , // { dg-error "comma at end" "" { target c++98 } } }; static int New(int); // { dg-error "declaration of" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cond.C b/gcc/testsuite/g++.old-deja/g++.jason/cond.C index a6e5ba0..b1e692e 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/cond.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/cond.C @@ -52,7 +52,7 @@ int main() // { dg-error "is initialized like a variable" "var" { target *-*-* } 51 } ; - if (int a[2] = {1, 2}) // { dg-error "extended init" } + if (int a[2] = {1, 2}) // { dg-error "extended init" "" { target c++98 } } ; } diff --git a/gcc/testsuite/g++.old-deja/g++.law/init1.C b/gcc/testsuite/g++.old-deja/g++.law/init1.C index 1727e38..3cce388 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init1.C @@ -9,12 +9,12 @@ public: class bar { public: - foo f[3] = { 1, 2, 3 }; // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" } ANSI C++ forbids initialization of member f; + foo f[3] = { 1, 2, 3 }; // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" "" { target c++98 } } ANSI C++ forbids initialization of member f; }; class bar2 { public: - foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" } ANSI C++ forbids initialization of member f; + foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" "" { target c++98 } } ANSI C++ forbids initialization of member f; // does not compile -- error: field initializer is not constant }; diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators32.C b/gcc/testsuite/g++.old-deja/g++.law/operators32.C index 20d148d..9e1a356 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators32.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators32.C @@ -7,7 +7,7 @@ // template <class T> -void ffree(long rows, T** array) // { dg-message "note" } +void ffree(long rows, T** array) { for( long i = 0; i < rows; i++ ) delete [] array[i]; // delete row @@ -21,7 +21,7 @@ return array = new T[size]; } template <class T> -T** allocate2d(long d1, long d2, T**& array) // { dg-message "note" } +T** allocate2d(long d1, long d2, T**& array) { if( allocate1d(d1, array) != 0 ) { @@ -49,9 +49,7 @@ foo() {std::cout << "foo created" << std::endl; } }; foo **f2; -allocate2d(d1, d2, f2);// { dg-error "" } type.*// ERROR - trying to.* -// { dg-message "candidate" "candidate note" { target *-*-* } 52 } -ffree(d1, f2);// { dg-error "" } type.*// ERROR - trying to.* -// { dg-message "candidate" "candidate note" { target *-*-* } 54 } +allocate2d(d1, d2, f2);// { dg-error "" "" { target c++98 } } +ffree(d1, f2);// { dg-error "" "" { target c++98 } } } diff --git a/gcc/testsuite/g++.old-deja/g++.other/anon9.C b/gcc/testsuite/g++.old-deja/g++.other/anon9.C index a364db8..d458b6b 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/anon9.C +++ b/gcc/testsuite/g++.old-deja/g++.other/anon9.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } // Test that we properly diagnose an attempt to use an anonymous class // in declaring an external function. diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C index 556ef97..2fa2dec 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } typedef struct { int i; } *p; diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage2.C b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C index 2385b22..974cd63 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/linkage2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } // From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> extern "C" { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/enum6.C b/gcc/testsuite/g++.old-deja/g++.pt/enum6.C index 254b48b..48bdbb0 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/enum6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/enum6.C @@ -8,7 +8,7 @@ void fn(T) { enum tern { H, L, X, U }; - vector<tern> ternvec; // { dg-error "" } composed from a local type + vector<tern> ternvec; // { dg-error "" "" { target c++98 } } composed from a local type } template void fn(int); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit70.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit70.C index dc9c6c9..1f53a75 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit70.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit70.C @@ -18,7 +18,7 @@ template int S<int>::t; // { dg-error "duplicate explicit instantiation" } template class S<double>; template class S<double>; // { dg-error "duplicate explicit instantiation" } -extern template void f(double); // { dg-error "extern" } extern not allowed +extern template void f(double); // { dg-error "extern" "" { target c++98 } } inline template class S<float>; // { dg-error "inline" } inline not allowed template <class T> diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C index 8802e98..19f1591 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C @@ -13,30 +13,22 @@ public: }; template <void (A::*)() > -void g() {} // { dg-message "void g" } +void g() {} template <int A::*> -void h() {} // { dg-message "void h" } +void h() {} int main() { g<&A::f>(); h<&A::i>(); g<&B::f>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 24 } h<&B::j>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 26 } - g<(void (A::*)()) &A::f>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 28 } - h<(int A::*) &A::i>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 30 } + g<(void (A::*)()) &A::f>(); // { dg-error "" "" { xfail c++11 } } + h<(int A::*) &A::i>(); // { dg-error "" "" { xfail c++11 } } g<(void (A::*)()) &B::f>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 32 } h<(int A::*) &B::j>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 34 } - g<(void (A::*)()) 0>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 36 } - h<(int A::*) 0>(); // { dg-error "" } - // { dg-message "candidate" "candidate note" { target *-*-* } 38 } + g<(void (A::*)()) 0>(); // { dg-error "" "" { target c++98 } } + h<(int A::*) 0>(); // { dg-error "" "" { target c++98 } } return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/t29.C b/gcc/testsuite/g++.old-deja/g++.pt/t29.C index bcc94a3..f664f54 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/t29.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/t29.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; } extern int i[30]; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/t30.C b/gcc/testsuite/g++.old-deja/g++.pt/t30.C index 45da04c..b0c4f2f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/t30.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/t30.C @@ -1,4 +1,4 @@ -// { dg-do assemble } +// { dg-do assemble { target c++98 } } template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; } extern int i[30], i2[33]; diff --git a/gcc/testsuite/g++.old-deja/old-deja.exp b/gcc/testsuite/g++.old-deja/old-deja.exp index ce53b5f..c941f40 100644 --- a/gcc/testsuite/g++.old-deja/old-deja.exp +++ b/gcc/testsuite/g++.old-deja/old-deja.exp @@ -21,7 +21,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'. @@ -32,7 +32,7 @@ dg-init set tests [lsort [find $srcdir/$subdir *.C]] # Main loop. -dg-runtest $tests "" $DEFAULT_CXXFLAGS +g++-dg-runtest $tests $DEFAULT_CXXFLAGS # All done. dg-finish diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp index ec81d03..e6ef74b 100644 --- a/gcc/testsuite/lib/g++-dg.exp +++ b/gcc/testsuite/lib/g++-dg.exp @@ -26,3 +26,36 @@ proc g++-dg-test { prog do_what extra_tool_flags } { proc g++-dg-prune { system text } { return [gcc-dg-prune $system $text] } + +# Modified dg-runtest that runs tests in both C++98 and C++11 modes +# unless they specifically specify one or the other. +proc g++-dg-runtest { testcases default-extra-flags } { + global runtests + + foreach test $testcases { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # If the testcase specifies a standard, use that one. + # If not, run it under both standards, allowing GNU extensions + # if there's a dg-options line. + if ![search_for $test "-std=*++"] { + if [search_for $test "dg-options"] { + set option_list { -std=gnu++98 -std=gnu++11 } + } else { + set option_list { -std=c++98 -std=c++11 } + } + } else { + set option_list { "" } + } + + set nshort [file tail [file dirname $test]]/[file tail $test] + + foreach flags $option_list { + verbose "Testing $nshort, $flags" 1 + dg-test $test $flags ${default-extra-flags} + } + } +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 61bae45..944a668 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4266,6 +4266,24 @@ proc check_effective_target_c++ { } { return 0 } +# Check which language standard is active by checking for the presence of +# one of the C++11 -std flags. This assumes that the default for the +# compiler is C++98, and that there will never be multiple -std= arguments +# on the command line. +proc check_effective_target_c++11 { } { + if ![check_effective_target_c++] { + return 0 + } + return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }] +} + +proc check_effective_target_c++98 { } { + if ![check_effective_target_c++] { + return 0 + } + return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }] +} + # Return 1 if expensive testcases should be run. proc check_effective_target_run_expensive_tests { } { |