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 <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
This commit is contained in:
Avi Drissman 2023-12-12 17:10:54 -05:00 committed by Crashpad LUCI CQ
parent 337b4f7971
commit 9f896f2581
7 changed files with 16 additions and 17 deletions

2
DEPS
View File

@ -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',

View File

@ -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"

View File

@ -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));
@ -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) {

View File

@ -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);
@ -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);

View File

@ -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"

View File

@ -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);
}

View File

@ -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);