diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-01-29 00:47:32 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-01-29 00:47:32 +0000 |
commit | 2104ca71da1120a7b2b35e3178624b04d30bdfde (patch) | |
tree | 38094898f4fce66deb06503640463d2a6c24854c /libstdc++-v3 | |
parent | 1f48525ded40b968792c4dfd9a7614c3e88129a4 (diff) | |
download | gcc-2104ca71da1120a7b2b35e3178624b04d30bdfde.zip gcc-2104ca71da1120a7b2b35e3178624b04d30bdfde.tar.gz gcc-2104ca71da1120a7b2b35e3178624b04d30bdfde.tar.bz2 |
Fix tests that fail in C++2a mode
The nested typedefs in std::reference_wrapper are no longer present in
C++2a mode, so skip the tests that check for them.
The addition of the [[nodiscard]] attribute to a few functions causes
some failures in tests that intentionally ignore the return value.
Casting the result to void suppresses the new warnings.
* testsuite/20_util/reference_wrapper/result_type.cc: Disable for
C++2a.
* testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
* testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise.
* testsuite/20_util/reference_wrapper/typedefs.cc: Likewise.
* testsuite/30_threads/async/54297.cc: Suppress nodiscard warning.
* testsuite/ext/array_allocator/26875.cc: Likewise.
* testsuite/ext/pool_allocator/allocate_chunk.cc: Likewise.
* testsuite/util/replacement_memory_operators.h: Likewise.
* testsuite/util/testsuite_allocator.h: Likewise.
From-SVN: r268355
Diffstat (limited to 'libstdc++-v3')
10 files changed, 22 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3003852..fc6f7d1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,16 @@ 2019-01-29 Jonathan Wakely <jwakely@redhat.com> + * testsuite/20_util/reference_wrapper/result_type.cc: Disable for + C++2a. + * testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise. + * testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise. + * testsuite/20_util/reference_wrapper/typedefs.cc: Likewise. + * testsuite/30_threads/async/54297.cc: Suppress nodiscard warning. + * testsuite/ext/array_allocator/26875.cc: Likewise. + * testsuite/ext/pool_allocator/allocate_chunk.cc: Likewise. + * testsuite/util/replacement_memory_operators.h: Likewise. + * testsuite/util/testsuite_allocator.h: Likewise. + * include/std/memory_resource (__pool_resource::_M_unpooled): Use normal mode vector, even for debug mode. * include/std/vector [_GLIBCXX_DEBUG] (_GLIBCXX_STD_C::pmr::vector): diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/result_type.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/result_type.cc index 81b4986..7c67283 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/result_type.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/result_type.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-skip-if "result_type removed for C++20" { c++2a } } // 2010-10-06 Paolo Carlini <paolo.carlini@oracle.com> diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-2.cc index 5db372c..e1aebd1 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-2.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-2.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-skip-if "argument_type removed for C++20" { c++2a } } // 2010-10-06 Paolo Carlini <paolo.carlini@oracle.com> diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc index 190fe91..5ca596a 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-skip-if "argument_type removed for C++20" { c++2a } } // Copyright (C) 2011-2019 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc index a17c1ed..1f4c77e 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-skip-if "result_type removed for C++20" { c++2a } } // Copyright (C) 2008-2019 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/async/54297.cc b/libstdc++-v3/testsuite/30_threads/async/54297.cc index 4a2d8fc..654ce40 100644 --- a/libstdc++-v3/testsuite/30_threads/async/54297.cc +++ b/libstdc++-v3/testsuite/30_threads/async/54297.cc @@ -45,5 +45,5 @@ struct Task int main() { - std::async(std::launch::async, Task()); + (void) std::async(std::launch::async, Task()); } diff --git a/libstdc++-v3/testsuite/ext/array_allocator/26875.cc b/libstdc++-v3/testsuite/ext/array_allocator/26875.cc index d4cbb04..e72e3b2 100644 --- a/libstdc++-v3/testsuite/ext/array_allocator/26875.cc +++ b/libstdc++-v3/testsuite/ext/array_allocator/26875.cc @@ -33,8 +33,8 @@ int main() try { - Allocator1.allocate(1); - Allocator2.allocate(1); + (void) Allocator1.allocate(1); + (void) Allocator2.allocate(1); } catch (std::bad_alloc& ex) { diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc b/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc index 1c958d6..b90778c 100644 --- a/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc +++ b/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc @@ -48,13 +48,13 @@ void test01() using __gnu_cxx::__pool_alloc; __pool_alloc<big> alloc_big; - alloc_big.allocate(1); + (void) alloc_big.allocate(1); // The constant 20 comes from __pool_alloc_base::_M_refill. See // also __pool_alloc_base::_M_allocate_chunk. __pool_alloc<small> alloc_small; for (unsigned int i = 0; i < 20 * sizeof(big) / sizeof(small) + 1; ++i) - alloc_small.allocate(1); + (void) alloc_small.allocate(1); } int main() diff --git a/libstdc++-v3/testsuite/util/replacement_memory_operators.h b/libstdc++-v3/testsuite/util/replacement_memory_operators.h index 9befe27..fb0b2be 100644 --- a/libstdc++-v3/testsuite/util/replacement_memory_operators.h +++ b/libstdc++-v3/testsuite/util/replacement_memory_operators.h @@ -64,7 +64,7 @@ namespace __gnu_test check_new(Alloc a = Alloc()) { __gnu_test::counter::exceptions(false); - a.allocate(10); + (void) a.allocate(10); const bool __b((__gnu_test::counter::count() > 0) == uses_global_new); if (!__b) throw std::logic_error("counter not incremented"); diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 0e77ff4..044b9d5 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -245,7 +245,7 @@ namespace __gnu_test Alloc a; try { - a.allocate(a.max_size() + 1); + (void) a.allocate(a.max_size() + 1); } catch(std::bad_alloc&) { |