Skip to content

Commit

Permalink
Qualify bit_cast with base::
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Avi Drissman <[email protected]>
  • Loading branch information
Avi Drissman authored and Crashpad LUCI CQ committed Dec 12, 2023
1 parent 337b4f7 commit 9f896f2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion client/ios_handler/exception_processor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <type_traits>
#include <typeinfo>

#include "base/bit_cast.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/memory/free_deleter.h"
Expand Down
7 changes: 4 additions & 3 deletions snapshot/linux/exception_snapshot_linux_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(expected.ucontext.uc_mcontext.gregs[REG_EAX]));
EXPECT_EQ(
actual.x86->eax,
base::bit_cast<uint32_t>(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));
Expand All @@ -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<uint64_t>(expected.uc_mcontext.gregs[REG_RAX]));
base::bit_cast<uint64_t>(expected.uc_mcontext.gregs[REG_RAX]));
for (unsigned int byte_offset = 0;
byte_offset < sizeof(actual.x86_64->fxsave);
++byte_offset) {
Expand Down
8 changes: 4 additions & 4 deletions util/linux/auxiliary_vector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ TEST(AuxiliaryVector, SignedBit) {
constexpr uint64_t type = 0x0000000012345678;

constexpr int32_t neg1_32 = -1;
aux.Insert(type, bit_cast<uint32_t>(neg1_32));
aux.Insert(type, base::bit_cast<uint32_t>(neg1_32));
int32_t outval32s;
ASSERT_TRUE(aux.GetValue(type, &outval32s));
EXPECT_EQ(outval32s, neg1_32);

constexpr int32_t int32_max = std::numeric_limits<int32_t>::max();
aux.Insert(type, bit_cast<uint32_t>(int32_max));
aux.Insert(type, base::bit_cast<uint32_t>(int32_max));
ASSERT_TRUE(aux.GetValue(type, &outval32s));
EXPECT_EQ(outval32s, int32_max);

Expand All @@ -204,13 +204,13 @@ TEST(AuxiliaryVector, SignedBit) {
EXPECT_EQ(outval32u, uint32_max);

constexpr int64_t neg1_64 = -1;
aux.Insert(type, bit_cast<uint64_t>(neg1_64));
aux.Insert(type, base::bit_cast<uint64_t>(neg1_64));
int64_t outval64s;
ASSERT_TRUE(aux.GetValue(type, &outval64s));
EXPECT_EQ(outval64s, neg1_64);

constexpr int64_t int64_max = std::numeric_limits<int64_t>::max();
aux.Insert(type, bit_cast<uint64_t>(int64_max));
aux.Insert(type, base::bit_cast<uint64_t>(int64_max));
ASSERT_TRUE(aux.GetValue(type, &outval64s));
EXPECT_EQ(outval64s, int64_max);

Expand Down
1 change: 0 additions & 1 deletion util/linux/memory_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <string.h>
#include <sys/sysmacros.h>

#include "base/bit_cast.h"
#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/logging.h"
Expand Down
12 changes: 6 additions & 6 deletions util/misc/reinterpret_bytes_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,27 @@ TEST(ReinterpretBytes, ToSigned) {
ExpectReinterpret(from64, &to64, static_cast<int64_t>(0));

to32 = -1;
from64 = bit_cast<uint32_t>(to32);
from64 = base::bit_cast<uint32_t>(to32);
ExpectReinterpret(from64, &to32, to32);

to32 = std::numeric_limits<int32_t>::max();
from64 = bit_cast<uint32_t>(to32);
from64 = base::bit_cast<uint32_t>(to32);
ExpectReinterpret(from64, &to32, to32);

to32 = std::numeric_limits<int32_t>::min();
from64 = bit_cast<uint32_t>(to32);
from64 = base::bit_cast<uint32_t>(to32);
ExpectReinterpret(from64, &to32, to32);

to64 = -1;
from64 = bit_cast<uint64_t>(to64);
from64 = base::bit_cast<uint64_t>(to64);
ExpectReinterpret(from64, &to64, to64);

to64 = std::numeric_limits<int64_t>::max();
from64 = bit_cast<uint64_t>(to64);
from64 = base::bit_cast<uint64_t>(to64);
ExpectReinterpret(from64, &to64, to64);

to64 = std::numeric_limits<int64_t>::min();
from64 = bit_cast<uint64_t>(to64);
from64 = base::bit_cast<uint64_t>(to64);
ExpectReinterpret(from64, &to64, to64);
}

Expand Down
2 changes: 1 addition & 1 deletion util/numeric/int128_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST(Int128, UInt128) {
uint128_struct uint128;
static_assert(sizeof(uint128) == sizeof(kBytes), "sizes must be equal");

uint128 = bit_cast<uint128_struct>(kBytes);
uint128 = base::bit_cast<uint128_struct>(kBytes);

EXPECT_EQ(uint128.lo, 0x0706050403020100u);
EXPECT_EQ(uint128.hi, 0x0f0e0d0c0b0a0908u);
Expand Down

0 comments on commit 9f896f2

Please sign in to comment.