Use nullptr instead of reinterpret_cast of NULL to pointer type
musl libc defines NULL as nullptr, which is explicitly allowed by
C++11. nullptr_t cannot be cast to a pointer with reinterpret_cast,
static_cast must be used instead. Use nullptr directly instead,
which doesn't require a cast to be compared to a pointer type.
Also use static_cast for the cast from void* to int*.
Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I1c6d92a88fd4518c73b3fb8e39de19e9b249615a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3400555
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Colin Cross <ccross@google.com>
Cr-Commit-Position: refs/heads/main@{#966067}
diff --git a/base/threading/thread_local_storage_unittest.cc b/base/threading/thread_local_storage_unittest.cc
index 9062ff0..64bc398 100644
--- a/base/threading/thread_local_storage_unittest.cc
+++ b/base/threading/thread_local_storage_unittest.cc
@@ -84,9 +84,9 @@
void ThreadLocalStorageCleanup(void *value) {
- int *ptr = reinterpret_cast<int*>(value);
+ int *ptr = static_cast<int*>(value);
// Destructors should never be called with a NULL.
- ASSERT_NE(reinterpret_cast<int*>(NULL), ptr);
+ ASSERT_NE(nullptr, ptr);
if (*ptr == kFinalTlsValue)
return; // We've been called enough times.
ASSERT_LT(kFinalTlsValue, *ptr);