Another bunch of fixes to make the testsuite work with any -std
option, and remove some redundancy.
I don't know why this file has "-x c" in the options, but since those
options come after the filename it's ignored and has no effect anyway:
Remove "-x c" from dg-options in libstdc++ C++ test
* testsuite/17_intro/freestanding.cc: Remove "-x c" from dg-options.
Self-explanatory:
Limit std::tuple tests to run for C++11 and later
* testsuite/20_util/tuple/cons/66338.cc: Limit test to C++11 and
later.
* testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc:
Likewise.
Make libstdc++ debug mode test valid for C++98
* testsuite/25_algorithms/lower_bound/debug/irreflexive.cc: Use
C++98-compatible initialization for array.
Remove unused headers and variables from libstdc++ tests
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc: Remove
unused header and variable from compile-only test.
* testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc: Likewise.
* testsuite/28_regex/basic_regex/assign/char/cstring.cc: Likewise.
* testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc: Likewise.
* testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:
Likewise.
Remove duplicate dg-options directive in string_view test
* testsuite/experimental/string_view/operations/rfind/char/2.cc:
Remove duplicate dg-options directive.
This is just to be consistent with every other pre-C++11 test, so that
grepping for (gnu|c)++98 finds them all:
Use -std=gnu++98 instead of -std=gnu++03 in test
* testsuite/20_util/specialized_algorithms/uninitialized_copy/
808590.cc: Use -std=gnu++98 instead of -std=gnu++03.
The target-specific linker options became redundant a few years ago
when these were changed to use { dg-do compile } (r205766):
Remove linker options from compile-only tests
* testsuite/20_util/make_signed/requirements/typedefs-2.cc: Remove
linker options from compile-only tests.
* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc:
Likewise.
These tests currently use a C++14 alias template, but there's no
reason they can't be run for C++11 mode too:
Run std::ios_base enum tests for C++11 and up
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Make test
supported for C++11 and later.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
(I suppose they could even run for C++98 if we added a preprocessor
check for __cplusplus >= 201103L around the static assertions at the
end.)
Tested powerpc64-linux, committed to trunk.
commit 87b28a03474977cea5e7135f5e914378acfb97cd
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 12:29:09 2016 +0100
Remove "-x c" from dg-options in libstdc++ C++ test
* testsuite/17_intro/freestanding.cc: Remove "-x c" from dg-options.
diff --git a/libstdc++-v3/testsuite/17_intro/freestanding.cc b/libstdc++-v3/testsuite/17_intro/freestanding.cc
index d0674dd..98e1d6c6 100644
--- a/libstdc++-v3/testsuite/17_intro/freestanding.cc
+++ b/libstdc++-v3/testsuite/17_intro/freestanding.cc
@@ -1,4 +1,4 @@
-// { dg-options "-x c -std=gnu++11 -lsupc++ -fvtable-verify=none" }
+// { dg-options "-std=gnu++11 -lsupc++ -fvtable-verify=none" }
// Copyright (C) 2010-2016 Free Software Foundation, Inc.
//
commit d54f9190792170a14be5dc4bde2a5da0325fb091
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 11:03:26 2016 +0100
Limit std::tuple tests to run for C++11 and later
* testsuite/20_util/tuple/cons/66338.cc: Limit test to C++11 and
later.
* testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc:
Likewise.
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
index f57eae9..8dd29b6 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-do compile { target c++11 } }
+
#include <tuple>
struct S {
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
index fe9bea6..a9bf954 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-do compile { target c++11 } }
+
#include <tuple>
using namespace std;
@@ -27,4 +29,3 @@ int main() {
tuple<Something> t1;
tuple<Something> t2 = t1;
}
-
commit 651e790145a79cb3fd68bc23e161d474c8335605
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 11:01:09 2016 +0100
Make libstdc++ debug mode test valid for C++98
* testsuite/25_algorithms/lower_bound/debug/irreflexive.cc: Use
C++98-compatible initialization for array.
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/irreflexive.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/irreflexive.cc
index f22452e..1554df0 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/irreflexive.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/irreflexive.cc
@@ -42,6 +42,6 @@ struct A_int_comparer
void test01()
{
- A as[] { 0, 1, 2, 3 };
+ A as[] = { 0, 1, 2, 3 };
std::lower_bound(as, as + 4, 1, A_int_comparer());
}
commit eaecdeb030629b96baa4d6bc83da8593ac9a7dc3
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 10:59:19 2016 +0100
Remove unused headers and variables from libstdc++ tests
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc: Remove
unused header and variable from compile-only test.
* testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc: Likewise.
* testsuite/28_regex/basic_regex/assign/char/cstring.cc: Likewise.
* testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc: Likewise.
* testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:
Likewise.
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
index edd3ffe..f1f399c 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
@@ -21,7 +21,6 @@
// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
#include <memory>
-#include <testsuite_hooks.h>
struct A { };
std::auto_ptr<A> source() { return std::auto_ptr<A>(); }
@@ -29,27 +28,19 @@ std::auto_ptr<A> source() { return std::auto_ptr<A>(); }
// 20.7.12.2.3 shared_ptr assignment [util.smartptr.shared.assign]
// Assignment from rvalue auto_ptr
-int
+void
test01()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
a = source();
-
- return 0;
}
-int
+void
test02()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
std::auto_ptr<A> au;
a = std::move(au);
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
index 4dd514e..5833437 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
@@ -21,7 +21,6 @@
// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
#include <memory>
-#include <testsuite_hooks.h>
struct A { };
std::unique_ptr<A> source() { return std::unique_ptr<A>(); }
@@ -29,27 +28,19 @@ std::unique_ptr<A> source() { return std::unique_ptr<A>(); }
// 20.7.12.2.3 shared_ptr assignment [util.smartptr.shared.assign]
// Assignment from rvalue unique_ptr
-int
+void
test01()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
a = source();
-
- return 0;
}
-int
+void
test02()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
std::unique_ptr<A> u;
a = std::move(u);
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
index 63b6dc6..5ee1b42 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/cstring.cc
@@ -22,13 +22,10 @@
// C++0X [28.8.3] class template basic_regex assign()
#include <regex>
-#include <testsuite_hooks.h>
// Tests assign operation from a C-style null-terminated-string.
void test01()
{
- bool test __attribute__((unused)) = true;
-
std::basic_regex<char> re;
const char* cs = "aab";
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc
index 2931e33..fbd49c8 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/string_wchar_t.cc
@@ -24,7 +24,6 @@
#include <string>
#include <regex>
-#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
// Tests C++ string constructor of the basic_regex class.
@@ -39,7 +38,6 @@ void test01()
void test02()
{
- bool test __attribute__((unused)) = true;
typedef std::basic_regex<wchar_t> test_type;
typedef __gnu_test::tracker_allocator<wchar_t> alloc_type;
diff --git a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc
index 8ff6b6c..7f735e0 100644
--- a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc
@@ -21,7 +21,6 @@
// 8.2.1 Class template shared_ptr [memory.smartptr.shared]
#include <experimental/memory>
-#include <testsuite_hooks.h>
struct A { virtual ~A() { } };
struct B : A { };
@@ -34,8 +33,6 @@ struct B : A { };
void
test01()
{
- bool test __attribute__((unused)) = true;
-
std::experimental::shared_ptr<A[3]> a;
a = std::experimental::shared_ptr<B[3]> (new B[3]); // { dg-error "no match " }
}
@@ -43,8 +40,6 @@ test01()
void
test02()
{
- bool test __attribute__((unused)) = true;
-
std::experimental::shared_ptr<A[]> a(new A[3]);
std::experimental::shared_ptr<A[2]> spa(a); // { dg-error "no matching" }
}
commit 74982c7bb9fb9d227fe707b0c2c7c74336c60552
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 10:55:35 2016 +0100
Remove duplicate dg-options directive in string_view test
* testsuite/experimental/string_view/operations/rfind/char/2.cc:
Remove duplicate dg-options directive.
diff --git a/libstdc++-v3/testsuite/experimental/string_view/operations/rfind/char/2.cc b/libstdc++-v3/testsuite/experimental/string_view/operations/rfind/char/2.cc
index 2aa7d76..390d33f 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/operations/rfind/char/2.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/operations/rfind/char/2.cc
@@ -12,7 +12,6 @@
// 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.
-// { dg-options "-std=gnu++14" }
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
commit 58fbb1687890c5d3c1f3b901f00e0e200ecde90d
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 10:54:10 2016 +0100
Use -std=gnu++98 instead of -std=gnu++03 in test
* testsuite/20_util/specialized_algorithms/uninitialized_copy/
808590.cc: Use -std=gnu++98 instead of -std=gnu++03.
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
index 179e747..e219644 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++03" }
+// { dg-options "-std=gnu++98" }
#include <vector>
#include <stdexcept>
commit f5c2a33122ba1e186755adfc969504a35c0ec68f
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 10:51:24 2016 +0100
Remove linker options from compile-only tests
* testsuite/20_util/make_signed/requirements/typedefs-2.cc: Remove
linker options from compile-only tests.
* testsuite/20_util/make_unsigned/requirements/typedefs-2.cc:
Likewise.
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
index f58e869..1da9173 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
@@ -1,5 +1,4 @@
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums" }
-// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <b...@redhat.com>
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
index 98d8bed..bb40fcc 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
@@ -1,5 +1,4 @@
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums" }
-// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <b...@redhat.com>
commit fd4519ce7fdc99245e376bae26f14b67789fafe0
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Aug 1 10:19:57 2016 +0100
Run std::ios_base enum tests for C++11 and up
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Make test
supported for C++11 and later.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
index d786e10..c0e9487 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
@@ -1,5 +1,5 @@
-// { dg-do compile }
-// { dg-options "-Wall" { target *-*-* } }
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
// -*- C++ -*-
// Copyright (C) 2004-2016 Free Software Foundation, Inc.
@@ -75,6 +75,7 @@ case_labels(bitmask_type b)
case ~__INT_MAX__:
break;
}
- static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+ using underlying_type = std::underlying_type<bitmask_type>::type;
+ static_assert( sizeof(underlying_type) == sizeof(int),
"underlying type has same range of values as int");
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
index 7d777b8..5ca9f5f 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
@@ -1,5 +1,5 @@
-// { dg-do compile }
-// { dg-options "-Wall" { target *-*-* } }
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
// -*- C++ -*-
// Copyright (C) 2004-2016 Free Software Foundation, Inc.
@@ -47,6 +47,7 @@ case_labels(bitmask_type b)
case ~__INT_MAX__:
break;
}
- static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+ using underlying_type = std::underlying_type<bitmask_type>::type;
+ static_assert( sizeof(underlying_type) == sizeof(int),
"underlying type has same range of values as int");
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
index bb9e96e..14a4984 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
@@ -1,5 +1,5 @@
-// { dg-do compile }
-// { dg-options "-Wall" { target *-*-* } }
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
// -*- C++ -*-
// Copyright (C) 2004-2016 Free Software Foundation, Inc.
@@ -51,6 +51,7 @@ case_labels(bitmask_type b)
case ~__INT_MAX__:
break;
}
- static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+ using underlying_type = std::underlying_type<bitmask_type>::type;
+ static_assert( sizeof(underlying_type) == sizeof(int),
"underlying type has same range of values as int");
}