diff options
author | Billy Robert O'Neal III <bion@microsoft.com> | 2017-11-21 21:37:26 +0000 |
---|---|---|
committer | Billy Robert O'Neal III <bion@microsoft.com> | 2017-11-21 21:37:26 +0000 |
commit | ba40b0566ff0e835bc8234a4651e8cbf76181c3e (patch) | |
tree | e06d8a46d0d11568b8e772d15a6d60fd220e9e2b /libcxx/test/std/utilities | |
parent | 9dc54e25f007bf5309894337c8682a678deb7033 (diff) | |
download | bcm5719-llvm-ba40b0566ff0e835bc8234a4651e8cbf76181c3e.tar.gz bcm5719-llvm-ba40b0566ff0e835bc8234a4651e8cbf76181c3e.zip |
Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
llvm-svn: 318804
Diffstat (limited to 'libcxx/test/std/utilities')
8 files changed, 17 insertions, 17 deletions
diff --git a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp index 5e0a116a5a5..419fd1a40cf 100644 --- a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp +++ b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp @@ -80,7 +80,7 @@ void checkThrows(any& a) { #if !defined(TEST_HAS_NO_EXCEPTIONS) try { - (void)any_cast<Type>(a); + TEST_IGNORE_NODISCARD any_cast<Type>(a); assert(false); } catch (bad_any_cast const &) { // do nothing @@ -89,7 +89,7 @@ void checkThrows(any& a) } try { - (void)any_cast<ConstT>(static_cast<any const&>(a)); + TEST_IGNORE_NODISCARD any_cast<ConstT>(static_cast<any const&>(a)); assert(false); } catch (bad_any_cast const &) { // do nothing @@ -103,7 +103,7 @@ void checkThrows(any& a) typename std::remove_reference<Type>::type&&, Type >::type; - (void)any_cast<RefType>(static_cast<any&&>(a)); + TEST_IGNORE_NODISCARD any_cast<RefType>(static_cast<any&&>(a)); assert(false); } catch (bad_any_cast const &) { // do nothing @@ -111,13 +111,13 @@ void checkThrows(any& a) assert(false); } #else - ((void)a); + (TEST_IGNORE_NODISCARD a); #endif } void test_cast_empty() { // None of these operations should allocate. - DisableAllocationGuard g; ((void)g); + DisableAllocationGuard g; (TEST_IGNORE_NODISCARD g); any a; checkThrows<int>(a); } diff --git a/libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp index d98b8d68b21..9850851fc6e 100644 --- a/libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp +++ b/libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp @@ -115,14 +115,14 @@ void test_make_any_throws() { { try { - (void)std::make_any<Type>(101); + TEST_IGNORE_NODISCARD std::make_any<Type>(101); assert(false); } catch (int const&) { } } { try { - (void)std::make_any<Type>({1, 2, 3}, 101); + TEST_IGNORE_NODISCARD std::make_any<Type>({1, 2, 3}, 101); assert(false); } catch (int const&) { } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp index e77e7d82ad5..34cbb8dc537 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp @@ -23,7 +23,7 @@ void test_max(size_t count) { std::allocator<T> a; try { - (void)a.allocate(count); + TEST_IGNORE_NODISCARD a.allocate(count); assert(false); } catch (const std::exception &) { } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp index d678bdedefc..8bd8993e5be 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp @@ -134,7 +134,7 @@ int main() #ifndef TEST_HAS_NO_EXCEPTIONS try { - (void)ptr->shared_from_this(); + TEST_IGNORE_NODISCARD ptr->shared_from_this(); assert(false); } catch (std::bad_weak_ptr const&) { } catch (...) { assert(false); } diff --git a/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp b/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp index b05fb71cdc6..50058a6208a 100644 --- a/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp +++ b/libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp @@ -19,6 +19,6 @@ int main() { std::unique_ptr<int[]> p(new int(3)); const std::unique_ptr<int[]>& cp = p; - (void)(*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}} - (void)(*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}} + TEST_IGNORE_NODISCARD (*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr<int []>' invalid)}} + TEST_IGNORE_NODISCARD (*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr<int []>' invalid)}} } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp index 74e6efd983b..2f7ee4442c3 100644 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp @@ -16,12 +16,12 @@ struct UserType {}; void test_bad_index() { std::tuple<long, long, char, std::string, char, UserType, char> t1; - (void)std::get<int>(t1); // expected-error@tuple:* {{type not found}} - (void)std::get<long>(t1); // expected-note {{requested here}} - (void)std::get<char>(t1); // expected-note {{requested here}} + TEST_IGNORE_NODISCARD std::get<int>(t1); // expected-error@tuple:* {{type not found}} + TEST_IGNORE_NODISCARD std::get<long>(t1); // expected-note {{requested here}} + TEST_IGNORE_NODISCARD std::get<char>(t1); // expected-note {{requested here}} // expected-error@tuple:* 2 {{type occurs more than once}} std::tuple<> t0; - (void)std::get<char*>(t0); // expected-node {{requested here}} + TEST_IGNORE_NODISCARD std::get<char*>(t0); // expected-node {{requested here}} // expected-error@tuple:* 1 {{type not in empty type list}} } diff --git a/libcxx/test/std/utilities/variant/variant.get/get_index.pass.cpp b/libcxx/test/std/utilities/variant/variant.get/get_index.pass.cpp index 0ec65309dbb..f52dc555646 100644 --- a/libcxx/test/std/utilities/variant/variant.get/get_index.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.get/get_index.pass.cpp @@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() { auto test = [](auto idx, auto &&v) { using Idx = decltype(idx); try { - (void)std::get<Idx::value>(std::forward<decltype(v)>(v)); + TEST_IGNORE_NODISCARD std::get<Idx::value>(std::forward<decltype(v)>(v)); } catch (const std::bad_variant_access &) { return true; } catch (...) { /* ... */ diff --git a/libcxx/test/std/utilities/variant/variant.get/get_type.pass.cpp b/libcxx/test/std/utilities/variant/variant.get/get_type.pass.cpp index 5d9213ed0a5..0a2222cbf27 100644 --- a/libcxx/test/std/utilities/variant/variant.get/get_type.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.get/get_type.pass.cpp @@ -259,7 +259,7 @@ void test_throws_for_all_value_categories() { auto test = [](auto idx, auto &&v) { using Idx = decltype(idx); try { - (void)std::get<typename Idx::type>(std::forward<decltype(v)>(v)); + TEST_IGNORE_NODISCARD std::get<typename Idx::type>(std::forward<decltype(v)>(v)); } catch (const std::bad_variant_access &) { return true; } catch (...) { /* ... */ |