STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
Mark bucket() assertions as nonportable. The Standard doesn't guarantee what bucket an element will land in, even if you control the hash. All such assertions are inherently nonportable and should be marked accordingly. http://reviews.llvm.org/D22157 Files: test/std/containers/unord/unord.map/bucket.pass.cpp test/std/containers/unord/unord.multimap/bucket.pass.cpp test/std/containers/unord/unord.multiset/bucket.pass.cpp test/std/containers/unord/unord.set/bucket.pass.cpp
Index: test/std/containers/unord/unord.set/bucket.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/bucket.pass.cpp +++ test/std/containers/unord/unord.set/bucket.pass.cpp @@ -22,6 +22,7 @@ #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" int main() @@ -42,7 +43,7 @@ size_t bc = c.bucket_count(); assert(bc >= 5); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #if TEST_STD_VER >= 11 { @@ -61,7 +62,7 @@ size_t bc = c.bucket_count(); assert(bc >= 5); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #endif #if _LIBCPP_DEBUG_LEVEL >= 1 Index: test/std/containers/unord/unord.multiset/bucket.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/bucket.pass.cpp +++ test/std/containers/unord/unord.multiset/bucket.pass.cpp @@ -22,6 +22,7 @@ #include <unordered_set> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" int main() @@ -42,7 +43,7 @@ size_t bc = c.bucket_count(); assert(bc >= 7); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #if TEST_STD_VER >= 11 { @@ -62,7 +63,7 @@ size_t bc = c.bucket_count(); assert(bc >= 7); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #endif #if _LIBCPP_DEBUG_LEVEL >= 1 Index: test/std/containers/unord/unord.multimap/bucket.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/bucket.pass.cpp +++ test/std/containers/unord/unord.multimap/bucket.pass.cpp @@ -23,6 +23,7 @@ #include <string> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" int main() @@ -43,7 +44,7 @@ size_t bc = c.bucket_count(); assert(bc >= 7); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #if TEST_STD_VER >= 11 { @@ -63,7 +64,7 @@ size_t bc = c.bucket_count(); assert(bc >= 7); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #endif #if _LIBCPP_DEBUG_LEVEL >= 1 Index: test/std/containers/unord/unord.map/bucket.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/bucket.pass.cpp +++ test/std/containers/unord/unord.map/bucket.pass.cpp @@ -23,6 +23,7 @@ #include <string> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" int main() @@ -43,7 +44,7 @@ size_t bc = c.bucket_count(); assert(bc >= 5); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #if TEST_STD_VER >= 11 { @@ -63,7 +64,7 @@ size_t bc = c.bucket_count(); assert(bc >= 5); for (size_t i = 0; i < 13; ++i) - assert(c.bucket(i) == i % bc); + LIBCPP_ASSERT(c.bucket(i) == i % bc); } #endif #if _LIBCPP_DEBUG_LEVEL >= 1
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits