From 9f896f2581c076ec028935b8d9703551eb73a796 Mon Sep 17 00:00:00 2001 From: Avi Drissman Date: Tue, 12 Dec 2023 17:10:54 -0500 Subject: [PATCH] Qualify bit_cast with base:: The real Chromium base/bit_cast.h is in the base namespace. mini_chromium's version was just changed to be in the base namespace as well. Roll to the latest mini_chromium and scope all calls to bit_cast. Bug: chromium:1506769 Change-Id: I7b25ee512f67694ef6ed3d0250e4f6a6db151eb3 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5116880 Reviewed-by: Mark Mentovai Commit-Queue: Avi Drissman --- DEPS | 2 +- client/ios_handler/exception_processor.mm | 1 - snapshot/linux/exception_snapshot_linux_test.cc | 7 ++++--- util/linux/auxiliary_vector_test.cc | 8 ++++---- util/linux/memory_map.cc | 1 - util/misc/reinterpret_bytes_test.cc | 12 ++++++------ util/numeric/int128_test.cc | 2 +- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/DEPS b/DEPS index 80c1aabf36..9559f70a43 100644 --- a/DEPS +++ b/DEPS @@ -47,7 +47,7 @@ deps = { '9719c1e1e676814c456b55f5f070eabad6709d31', 'crashpad/third_party/mini_chromium/mini_chromium': Var('chromium_git') + '/chromium/mini_chromium@' + - '9e21183c1ea369398d6f6ddd302c8db580bd19c4', + 'ac3e7323953425b2b48af2536f5a6f778dcd0f4c', 'crashpad/third_party/libfuzzer/src': Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' + 'fda403cf93ecb8792cb1d061564d89a6553ca020', diff --git a/client/ios_handler/exception_processor.mm b/client/ios_handler/exception_processor.mm index f68963a05b..0268b3a128 100644 --- a/client/ios_handler/exception_processor.mm +++ b/client/ios_handler/exception_processor.mm @@ -43,7 +43,6 @@ #include #include -#include "base/bit_cast.h" #include "base/format_macros.h" #include "base/logging.h" #include "base/memory/free_deleter.h" diff --git a/snapshot/linux/exception_snapshot_linux_test.cc b/snapshot/linux/exception_snapshot_linux_test.cc index 94f45f1eb9..b351ccaa7f 100644 --- a/snapshot/linux/exception_snapshot_linux_test.cc +++ b/snapshot/linux/exception_snapshot_linux_test.cc @@ -66,8 +66,9 @@ void InitializeContext(NativeCPUContext* context) { void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { EXPECT_EQ(actual.architecture, kCPUArchitectureX86); - EXPECT_EQ(actual.x86->eax, - bit_cast(expected.ucontext.uc_mcontext.gregs[REG_EAX])); + EXPECT_EQ( + actual.x86->eax, + base::bit_cast(expected.ucontext.uc_mcontext.gregs[REG_EAX])); for (unsigned int byte_offset = 0; byte_offset < sizeof(actual.x86->fxsave); ++byte_offset) { SCOPED_TRACE(base::StringPrintf("byte offset = %u\n", byte_offset)); @@ -87,7 +88,7 @@ void InitializeContext(NativeCPUContext* context) { void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) { EXPECT_EQ(actual.architecture, kCPUArchitectureX86_64); EXPECT_EQ(actual.x86_64->rax, - bit_cast(expected.uc_mcontext.gregs[REG_RAX])); + base::bit_cast(expected.uc_mcontext.gregs[REG_RAX])); for (unsigned int byte_offset = 0; byte_offset < sizeof(actual.x86_64->fxsave); ++byte_offset) { diff --git a/util/linux/auxiliary_vector_test.cc b/util/linux/auxiliary_vector_test.cc index 0c97781faa..f171ef84c4 100644 --- a/util/linux/auxiliary_vector_test.cc +++ b/util/linux/auxiliary_vector_test.cc @@ -187,13 +187,13 @@ TEST(AuxiliaryVector, SignedBit) { constexpr uint64_t type = 0x0000000012345678; constexpr int32_t neg1_32 = -1; - aux.Insert(type, bit_cast(neg1_32)); + aux.Insert(type, base::bit_cast(neg1_32)); int32_t outval32s; ASSERT_TRUE(aux.GetValue(type, &outval32s)); EXPECT_EQ(outval32s, neg1_32); constexpr int32_t int32_max = std::numeric_limits::max(); - aux.Insert(type, bit_cast(int32_max)); + aux.Insert(type, base::bit_cast(int32_max)); ASSERT_TRUE(aux.GetValue(type, &outval32s)); EXPECT_EQ(outval32s, int32_max); @@ -204,13 +204,13 @@ TEST(AuxiliaryVector, SignedBit) { EXPECT_EQ(outval32u, uint32_max); constexpr int64_t neg1_64 = -1; - aux.Insert(type, bit_cast(neg1_64)); + aux.Insert(type, base::bit_cast(neg1_64)); int64_t outval64s; ASSERT_TRUE(aux.GetValue(type, &outval64s)); EXPECT_EQ(outval64s, neg1_64); constexpr int64_t int64_max = std::numeric_limits::max(); - aux.Insert(type, bit_cast(int64_max)); + aux.Insert(type, base::bit_cast(int64_max)); ASSERT_TRUE(aux.GetValue(type, &outval64s)); EXPECT_EQ(outval64s, int64_max); diff --git a/util/linux/memory_map.cc b/util/linux/memory_map.cc index 58de835ed1..5838357372 100644 --- a/util/linux/memory_map.cc +++ b/util/linux/memory_map.cc @@ -18,7 +18,6 @@ #include #include -#include "base/bit_cast.h" #include "base/check_op.h" #include "base/files/file_path.h" #include "base/logging.h" diff --git a/util/misc/reinterpret_bytes_test.cc b/util/misc/reinterpret_bytes_test.cc index ba72bc526f..80bb979b98 100644 --- a/util/misc/reinterpret_bytes_test.cc +++ b/util/misc/reinterpret_bytes_test.cc @@ -75,27 +75,27 @@ TEST(ReinterpretBytes, ToSigned) { ExpectReinterpret(from64, &to64, static_cast(0)); to32 = -1; - from64 = bit_cast(to32); + from64 = base::bit_cast(to32); ExpectReinterpret(from64, &to32, to32); to32 = std::numeric_limits::max(); - from64 = bit_cast(to32); + from64 = base::bit_cast(to32); ExpectReinterpret(from64, &to32, to32); to32 = std::numeric_limits::min(); - from64 = bit_cast(to32); + from64 = base::bit_cast(to32); ExpectReinterpret(from64, &to32, to32); to64 = -1; - from64 = bit_cast(to64); + from64 = base::bit_cast(to64); ExpectReinterpret(from64, &to64, to64); to64 = std::numeric_limits::max(); - from64 = bit_cast(to64); + from64 = base::bit_cast(to64); ExpectReinterpret(from64, &to64, to64); to64 = std::numeric_limits::min(); - from64 = bit_cast(to64); + from64 = base::bit_cast(to64); ExpectReinterpret(from64, &to64, to64); } diff --git a/util/numeric/int128_test.cc b/util/numeric/int128_test.cc index 2166c9a43f..5bc9e4159c 100644 --- a/util/numeric/int128_test.cc +++ b/util/numeric/int128_test.cc @@ -33,7 +33,7 @@ TEST(Int128, UInt128) { uint128_struct uint128; static_assert(sizeof(uint128) == sizeof(kBytes), "sizes must be equal"); - uint128 = bit_cast(kBytes); + uint128 = base::bit_cast(kBytes); EXPECT_EQ(uint128.lo, 0x0706050403020100u); EXPECT_EQ(uint128.hi, 0x0f0e0d0c0b0a0908u);