Skip to content

Commit

Permalink
Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. R…
Browse files Browse the repository at this point in the history
…eviewed as https://reviews.llvm.org/D40065

llvm-svn: 318804
  • Loading branch information
BillyONeal committed Nov 21, 2017
1 parent 9dc54e2 commit ba40b05
Show file tree
Hide file tree
Showing 65 changed files with 103 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test()
count_equal::count = 0;

// Check that we properly convert the size argument to an integral.
(void)std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(4), 0, count_equal());
TEST_IGNORE_NODISCARD std::search_n(Iter(ic), Iter(ic+sc), UserDefinedIntegral<unsigned>(4), 0, count_equal());
count_equal::count = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)m.at(6);
TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
Expand Down Expand Up @@ -79,7 +79,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)m.at(6);
TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
Expand Down Expand Up @@ -115,7 +115,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)m.at(6);
TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
Expand Down Expand Up @@ -148,7 +148,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)m.at(6);
TEST_IGNORE_NODISCARD m.at(6);
assert(false);
}
catch (std::out_of_range&)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_no_type> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_private> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::map<int, double, transparent_less_not_a_type> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;

(void)M().count(C2Int{5});
TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;

(void)M().equal_range(C2Int{5});
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;

(void)M().find(C2Int{5});
TEST_IGNORE_NODISCARD M().find(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;

(void)M().lower_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_private> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;

(void)M().upper_bound(C2Int{5});
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
}
}
#endif
4 changes: 2 additions & 2 deletions libcxx/test/std/containers/sequences/array/at.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void) c.at(3);
TEST_IGNORE_NODISCARD c.at(3);
assert(false);
}
catch (const std::out_of_range &) {}
Expand All @@ -69,7 +69,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void) c.at(3);
TEST_IGNORE_NODISCARD c.at(3);
assert(false);
}
catch (const std::out_of_range &) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)c.at(11);
TEST_IGNORE_NODISCARD c.at(11);
assert(false);
}
catch (std::out_of_range&)
Expand Down Expand Up @@ -130,7 +130,7 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
(void)c.at(11);
TEST_IGNORE_NODISCARD c.at(11);
assert(false);
}
catch (std::out_of_range&)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
// Make sure that the error_code bits of <system_error> are self-contained.

#include <system_error>
#include "test_macros.h"

int main()
{
std::error_code x;
(void) x.category(); // returns a std::error_category &
(void) x.default_error_condition(); // std::error_condition
(void) x.message(); // returns a std::string
TEST_IGNORE_NODISCARD x.category(); // returns a std::error_category &
TEST_IGNORE_NODISCARD x.default_error_condition(); // std::error_condition
TEST_IGNORE_NODISCARD x.message(); // returns a std::string
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
// Make sure that the error_condition bits of <system_error> are self-contained.

#include <system_error>
#include "test_macros.h"

int main()
{
std::error_condition x = std::errc(0);
(void) x.category(); // returns a std::error_condition &
(void) x.message(); // returns a std::string
TEST_IGNORE_NODISCARD x.category(); // returns a std::error_condition &
TEST_IGNORE_NODISCARD x.message(); // returns a std::string
}
8 changes: 4 additions & 4 deletions libcxx/test/std/iterators/iterator.range/begin-end.fail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ namespace Foo {

int main(){
// Bug #28927 - shouldn't find these via ADL
(void) std::cbegin (Foo::FakeContainer());
(void) std::cend (Foo::FakeContainer());
(void) std::crbegin(Foo::FakeContainer());
(void) std::crend (Foo::FakeContainer());
TEST_IGNORE_NODISCARD std::cbegin (Foo::FakeContainer());
TEST_IGNORE_NODISCARD std::cend (Foo::FakeContainer());
TEST_IGNORE_NODISCARD std::crbegin(Foo::FakeContainer());
TEST_IGNORE_NODISCARD std::crend (Foo::FakeContainer());
}
#endif

0 comments on commit ba40b05

Please sign in to comment.