diff options
author | Colin Cross <ccross@google.com> | 2022-02-02 06:08:45 +0000 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2022-02-03 14:32:23 -0800 |
commit | d524f97614b49e5f0804dd16226b6990f7cfcfa5 (patch) | |
tree | 910ef5935fe17815df70a1858bb3bf37d08315a1 | |
parent | 7e6a2645d0f924fe9df6a51140614a792c8dc6d9 (diff) | |
download | libchrome-android-s-qpr3-beta-1.tar.gz |
Use nullptr instead of reinterpret_cast of NULL to pointer typeandroid-t-preview-2android-t-preview-1android-t-beta-3android-s-v2-beta-3android-s-qpr3-beta-1android-t-preview-1android-s-v2-beta-3android-s-qpr3-beta-1
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}
-rw-r--r-- | base/threading/thread_local_storage_unittest.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/base/threading/thread_local_storage_unittest.cc b/base/threading/thread_local_storage_unittest.cc index 9062ff0c7f..64bc398cea 100644 --- a/base/threading/thread_local_storage_unittest.cc +++ b/base/threading/thread_local_storage_unittest.cc @@ -84,9 +84,9 @@ class ThreadLocalStorageRunner : public DelegateSimpleThread::Delegate { 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); |