fix warnings only produced by apple-clang

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-12-24 01:07:54 +00:00
parent 9d2fd1f556
commit e9784032ce
8 changed files with 27 additions and 44 deletions

View File

@@ -33,12 +33,12 @@ test2(unsigned n)
assert(static_cast<unsigned>(DefaultOnly::count) == n); assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n); assert(d.size() == n);
assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T()); assert(*i == T());
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }
assert(DefaultOnly::count == 0); assert(DefaultOnly::count == 0);
#else
((void)n);
#endif #endif
} }
@@ -54,10 +54,10 @@ test1(unsigned n)
assert(static_cast<unsigned>(DefaultOnly::count) == n); assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n); assert(d.size() == n);
assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size()); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i) for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T()); assert(*i == T());
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif
} }
assert(DefaultOnly::count == 0); assert(DefaultOnly::count == 0);
} }
@@ -74,6 +74,9 @@ test3(unsigned n, Allocator const &alloc = Allocator())
assert(d.size() == n); assert(d.size() == n);
assert(d.get_allocator() == alloc); assert(d.get_allocator() == alloc);
} }
#else
((void)n);
((void)alloc);
#endif #endif
} }

View File

@@ -32,6 +32,9 @@ test3(unsigned n, Allocator const &alloc = Allocator())
assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n); assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
assert(d.get_allocator() == alloc); assert(d.get_allocator() == alloc);
} }
#else
((void)n);
((void)alloc);
#endif #endif
} }
@@ -76,14 +79,12 @@ int main()
test3<int, min_allocator<int>> (3); test3<int, min_allocator<int>> (3);
} }
#endif #endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11
{ {
std::list<DefaultOnly> l(3); std::list<DefaultOnly> l(3);
assert(l.size() == 3); assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3); assert(std::distance(l.begin(), l.end()) == 3);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
{ {
std::list<int, min_allocator<int>> l(3); std::list<int, min_allocator<int>> l(3);
assert(l.size() == 3); assert(l.size() == 3);
@@ -95,12 +96,10 @@ int main()
++i; ++i;
assert(*i == 0); assert(*i == 0);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3); std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3);
assert(l.size() == 3); assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3); assert(std::distance(l.begin(), l.end()) == 3);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif #endif
} }

View File

@@ -31,6 +31,9 @@ test2(typename C::size_type n,
assert(c.get_allocator() == a); assert(c.get_allocator() == a);
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type()); assert(*i == typename C::value_type());
#else
((void)n);
((void)a);
#endif #endif
} }

View File

@@ -32,6 +32,9 @@ test2(typename C::size_type n, typename C::allocator_type const& a = typename C:
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type()); assert(*i == typename C::value_type());
#else
((void)n);
((void)a);
#endif #endif
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <unordered_map> // <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -30,23 +32,13 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::unordered_multimap<int, std::string, typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >, test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >, test_compare<std::equal_to<int> >,
test_allocator<std::pair<const int, std::string> > test_allocator<std::pair<const int, std::string> >
> C; > C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c0(7, C c0(7,
test_hash<std::hash<int> >(8), test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9), test_compare<std::equal_to<int> >(9),
@@ -130,23 +122,12 @@ int main()
assert(c0.empty()); assert(c0.empty());
} }
#if TEST_STD_VER >= 11
{ {
typedef std::unordered_multimap<int, std::string, typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >, test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >, test_compare<std::equal_to<int> >,
min_allocator<std::pair<const int, std::string> > min_allocator<std::pair<const int, std::string> >
> C; > C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c0(7, C c0(7,
test_hash<std::hash<int> >(8), test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9), test_compare<std::equal_to<int> >(9),
@@ -230,7 +211,6 @@ int main()
assert(c0.empty()); assert(c0.empty());
} }
#endif
#if _LIBCPP_DEBUG >= 1 #if _LIBCPP_DEBUG >= 1
{ {
std::unordered_multimap<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}}; std::unordered_multimap<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}};
@@ -242,5 +222,4 @@ int main()
assert(s2.size() == 2); assert(s2.size() == 2);
} }
#endif #endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@@ -26226,25 +26226,25 @@ int main()
std::locale lg(lc, new my_numpunct); std::locale lg(lc, new my_numpunct);
const my_facet f(1); const my_facet f(1);
{ {
long double v = -INFINITY; long double v = -INFINITY; ((void)v);
} }
{ {
long double v = std::nan(""); long double v = std::nan(""); ((void)v);
} }
{ {
long double v = +0.; long double v = +0.; ((void)v);
} }
{ {
long double v = -INFINITY; long double v = -INFINITY; ((void)v);
} }
{ {
long double v = std::nan(""); long double v = std::nan(""); ((void)v);
} }
{ {
long double v = -INFINITY; long double v = -INFINITY; ((void)v);
} }
{ {
long double v = std::nan(""); long double v = std::nan(""); ((void)v);
} }
} }

View File

@@ -24,7 +24,6 @@ int main()
typedef std::sub_match<const CharT*> SM; typedef std::sub_match<const CharT*> SM;
typedef SM::string_type string; typedef SM::string_type string;
SM sm = SM(); SM sm = SM();
SM sm2 = SM();
assert(sm.compare(string()) == 0); assert(sm.compare(string()) == 0);
const CharT s[] = {'1', '2', '3', 0}; const CharT s[] = {'1', '2', '3', 0};
sm.first = s; sm.first = s;
@@ -38,7 +37,6 @@ int main()
typedef std::sub_match<const CharT*> SM; typedef std::sub_match<const CharT*> SM;
typedef SM::string_type string; typedef SM::string_type string;
SM sm = SM(); SM sm = SM();
SM sm2 = SM();
assert(sm.compare(string()) == 0); assert(sm.compare(string()) == 0);
const CharT s[] = {'1', '2', '3', 0}; const CharT s[] = {'1', '2', '3', 0};
sm.first = s; sm.first = s;

View File

@@ -23,7 +23,6 @@ int main()
typedef char CharT; typedef char CharT;
typedef std::sub_match<const CharT*> SM; typedef std::sub_match<const CharT*> SM;
SM sm = SM(); SM sm = SM();
SM sm2 = SM();
assert(sm.compare("") == 0); assert(sm.compare("") == 0);
const CharT s[] = {'1', '2', '3', 0}; const CharT s[] = {'1', '2', '3', 0};
sm.first = s; sm.first = s;
@@ -36,7 +35,6 @@ int main()
typedef wchar_t CharT; typedef wchar_t CharT;
typedef std::sub_match<const CharT*> SM; typedef std::sub_match<const CharT*> SM;
SM sm = SM(); SM sm = SM();
SM sm2 = SM();
assert(sm.compare(L"") == 0); assert(sm.compare(L"") == 0);
const CharT s[] = {'1', '2', '3', 0}; const CharT s[] = {'1', '2', '3', 0};
sm.first = s; sm.first = s;