aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/experimental
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-10-29 22:47:21 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-10-29 22:47:21 +0000
commit13feb0234b136fbdc1dbfba3a9663fb4e1043f75 (patch)
treed05a39206b08d2b19889146875b6cb6aac63abc0 /libstdc++-v3/testsuite/experimental
parent11dc4c4e137a9b48d585d7b1b146fb8404e3e1fe (diff)
downloadgcc-13feb0234b136fbdc1dbfba3a9663fb4e1043f75.zip
gcc-13feb0234b136fbdc1dbfba3a9663fb4e1043f75.tar.gz
gcc-13feb0234b136fbdc1dbfba3a9663fb4e1043f75.tar.bz2
libstdc++: Avoid warnings in tests
This fixes some warnings emitted when testing with warning flags added. Some of these are only necessary when testing with -Wsystem-headers, but either way it cleans up the tests to be less noisy under non-default flags. libstdc++-v3/ChangeLog: * testsuite/18_support/96817.cc: Avoid -Wunused warnings. * testsuite/20_util/any/assign/2.cc: Likewise. * testsuite/20_util/any/cons/2.cc: Likewise. * testsuite/20_util/align/1.cc: Avoid -Wsign-compare warning. * testsuite/20_util/function/65760.cc: Avoid -Wunused warning. * testsuite/20_util/function/1.cc: Avoid -Wcatch-value warning. * testsuite/20_util/function/cons/move_target.cc: Avoid -Wunused warning. * testsuite/20_util/headers/memory/synopsis.cc: Add exception specification. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Avoid -Wsign-compare warning. * testsuite/20_util/tuple/cons/deduction.cc: Avoid -Wunused warning. * testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc: Avoid -Wdeprecated-copy warning. * testsuite/21_strings/basic_string/56166.cc: Avoid -Wcatch-value warning. * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: Avoid -Wcatch-value warnings. * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc: Prune additional diagnostics. * testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc: Likewise. * testsuite/21_strings/headers/string/synopsis.cc: Add exception specifications. * testsuite/22_locale/locale/cons/12352.cc: Define sized delete operators to avoid warnings. * testsuite/23_containers/deque/modifiers/swap/1.cc: Add exception specification. * testsuite/23_containers/forward_list/cons/11.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/headers/bitset/synopsis.cc: Add exception specification. * testsuite/23_containers/headers/deque/synopsis.cc: Likewise. * testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise. * testsuite/23_containers/headers/list/synopsis.cc: Likewise. * testsuite/23_containers/headers/map/synopsis.cc: Likewise. * testsuite/23_containers/headers/queue/synopsis.cc: Likewise. * testsuite/23_containers/headers/set/synopsis.cc: Likewise. * testsuite/23_containers/headers/vector/synopsis.cc: Likewise. * testsuite/23_containers/list/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/map/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multiset/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/set/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/unordered_set/56267-2.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/vector/bool/23632.cc: Avoid -Wempty-body warning. * testsuite/23_containers/vector/modifiers/swap/1.cc: Add exception specification. * testsuite/25_algorithms/heap/moveable2.cc: Fix misplaced parentheses around arguments. * testsuite/25_algorithms/sample/1.cc: Use return value. * testsuite/25_algorithms/search/searcher.cc: Avoid -Wunused warnings. * testsuite/27_io/basic_ostream/exceptions/char/9561.cc: Likewise. * testsuite/27_io/basic_ostream/exceptions/wchar_t/9561.cc: Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc: Avoid -Wsign-compare warning. * testsuite/experimental/any/assign/2.cc: Avoid -Wunused warnings. * testsuite/experimental/any/cons/2.cc: Likewise. * testsuite/experimental/filesystem/operations/remove_all.cc: Avoid -Wign-compare warning. * testsuite/experimental/memory/observer_ptr/cons/cons.cc: Likewise. * testsuite/experimental/memory_resource/null_memory_resource.cc: Likewise. * testsuite/experimental/source_location/1.cc: Avoid -Waddress warning. * testsuite/ext/pod_char_traits.cc: Avoid -Wunused warning. * testsuite/ext/vstring/modifiers/clear/56166.cc: Avoid -Wcatch-value. * testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc: Avoid -Wunused warning. * testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc: Likewise. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Prune additional warnings. * testsuite/tr1/3_function_objects/function/1.cc: Avoid -Wcatch-value warning. * testsuite/util/replacement_memory_operators.h: Define sized delete to avoid warnings. * testsuite/util/testsuite_api.h (_NonDefaultConstructible): Add user-declared assignment operator to stop -Wdeprecated-copy warnings. * testsuite/util/testsuite_containers.h: Avoid -Wunused warning. * testsuite/util/testsuite_iterators.h: Avoid -Wsign-compare warnings. * testsuite/util/testsuite_new_operators.h: Define sized deleted.
Diffstat (limited to 'libstdc++-v3/testsuite/experimental')
-rw-r--r--libstdc++-v3/testsuite/experimental/any/assign/2.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/any/cons/2.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/memory/observer_ptr/cons/cons.cc1
-rw-r--r--libstdc++-v3/testsuite/experimental/memory_resource/null_memory_resource.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/source_location/1.cc13
6 files changed, 13 insertions, 13 deletions
diff --git a/libstdc++-v3/testsuite/experimental/any/assign/2.cc b/libstdc++-v3/testsuite/experimental/any/assign/2.cc
index e38455b..c2d7fec 100644
--- a/libstdc++-v3/testsuite/experimental/any/assign/2.cc
+++ b/libstdc++-v3/testsuite/experimental/any/assign/2.cc
@@ -31,14 +31,14 @@ struct X
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
diff --git a/libstdc++-v3/testsuite/experimental/any/cons/2.cc b/libstdc++-v3/testsuite/experimental/any/cons/2.cc
index d6af447..d6241ae 100644
--- a/libstdc++-v3/testsuite/experimental/any/cons/2.cc
+++ b/libstdc++-v3/testsuite/experimental/any/cons/2.cc
@@ -30,14 +30,14 @@ struct X
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
index 0e2aeda..c346a95 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
@@ -124,7 +124,7 @@ test04()
// remove write permission on the directory:
fs::permissions(dir, fs::perms::owner_read|fs::perms::owner_exec);
n = fs::remove_all(dir, ec);
- VERIFY( n == -1 );
+ VERIFY( n == std::uintmax_t(-1) );
VERIFY( ec == std::errc::permission_denied ); // not ENOTEMPTY
try {
diff --git a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/cons/cons.cc b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/cons/cons.cc
index 4b29da2..3d6bb41 100644
--- a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/cons/cons.cc
+++ b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/cons/cons.cc
@@ -44,7 +44,6 @@ void test02()
void test03()
{
- int x{};
observer_ptr<int> a;
observer_ptr<const int> b{a};
VERIFY(a == b);
diff --git a/libstdc++-v3/testsuite/experimental/memory_resource/null_memory_resource.cc b/libstdc++-v3/testsuite/experimental/memory_resource/null_memory_resource.cc
index 01d4a94..284b428 100644
--- a/libstdc++-v3/testsuite/experimental/memory_resource/null_memory_resource.cc
+++ b/libstdc++-v3/testsuite/experimental/memory_resource/null_memory_resource.cc
@@ -31,7 +31,7 @@ test06()
memory_resource* r = null_memory_resource();
bool caught = false;
- void* p = nullptr;
+ void* p __attribute__((unused)) = nullptr;
try {
p = r->allocate(1);
} catch (const std::bad_alloc&) {
diff --git a/libstdc++-v3/testsuite/experimental/source_location/1.cc b/libstdc++-v3/testsuite/experimental/source_location/1.cc
index 9f5a00d..5ca5b3a 100644
--- a/libstdc++-v3/testsuite/experimental/source_location/1.cc
+++ b/libstdc++-v3/testsuite/experimental/source_location/1.cc
@@ -17,6 +17,7 @@
// { dg-do run { target c++14 } }
// { dg-require-cstdint "" }
+// { dg-options "-Wno-address" }
#include <experimental/source_location>
#include <experimental/string_view>
@@ -29,7 +30,7 @@ void
test01()
{
constexpr source_location loc = source_location::current();
- static_assert( loc.line() == 31 );
+ static_assert( loc.line() == 32 );
// static_assert( loc.column() == 35 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
@@ -51,13 +52,13 @@ struct S {
void test02()
{
S s0;
- VERIFY( s0.loc.line() == 53 );
+ VERIFY( s0.loc.line() == 54 );
// static_assert( s0.loc.column() == 7 );
VERIFY( s0.loc.file_name() == __FILE__ );
VERIFY( s0.loc.function_name() == string_view(__FUNCTION__) );
S s1(1);
- VERIFY( s1.loc.line() == 47 );
+ VERIFY( s1.loc.line() == 48 );
VERIFY( s1.loc.file_name() == __FILE__ );
VERIFY( s1.loc.function_name() == s1.func );
}
@@ -75,21 +76,21 @@ source_location g(string_view& func) {
void test03()
{
auto loc = f(); // f's first argument corresponds to this line of code
- VERIFY( loc.line() == 77 );
+ VERIFY( loc.line() == 78 );
// static_assert( loc.column() == 16 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
source_location c = source_location::current();
loc = f(c); // f's first argument gets the same values as c, above
- VERIFY( loc.line() == 83 );
+ VERIFY( loc.line() == 84 );
// static_assert( loc.column() == 23 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
string_view func;
loc = g(func);
- VERIFY( loc.line() == 70 );
+ VERIFY( loc.line() == 71 );
// static_assert( loc.column() == 23 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == func );