mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-24 13:11:44 +08:00
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. From-SVN: r181222
This commit is contained in:
parent
754ca64333
commit
e399136a6a
ChangeLogMakefile.defMakefile.in
gcc
cp
testsuite
ChangeLog
g++.dg
g++.old-deja
lib
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -1 +1 @@
|
||||
template<typename... Args> class tuple; // { dg-error "variadic templates" }
|
||||
template<typename... Args> class tuple; // { dg-error "variadic templates" "" { target c++98 } }
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -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 } }
|
||||
|
@ -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 };
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 } }
|
||||
|
@ -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] {
|
||||
|
@ -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 } }
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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(...);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// PR c++/48420
|
||||
// { dg-do compile { target c++98 } }
|
||||
|
||||
void foo(int* p);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// { dg-do assemble }
|
||||
// { dg-do assemble { target c++98 } }
|
||||
// prms-id: 12475
|
||||
|
||||
#include <limits.h>
|
||||
|
@ -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 *);
|
||||
|
@ -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 ++ ; }
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 } }
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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 ];
|
||||
|
@ -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 } }
|
||||
|
@ -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 } }
|
||||
|
@ -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" }
|
||||
|
@ -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 } }
|
||||
;
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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 } }
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// { dg-do assemble }
|
||||
// { dg-do assemble { target c++98 } }
|
||||
typedef struct {
|
||||
int i;
|
||||
} *p;
|
||||
|
@ -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"
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 { } {
|
||||
|
Loading…
x
Reference in New Issue
Block a user