Use unsigned in a CHECK_EQ() comparison the compiler can't deduce.

The ABSL logging check seems to prevent the compiler from seeing
that comparing values for equality is equivalent if comparing
with a signed or unsigned zero literal...

Fixes: #11743
PiperOrigin-RevId: 507010435
pull/11808/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 7559399393
commit 8fb98cfb75
  1. 2
      src/google/protobuf/arena.cc

@ -521,7 +521,7 @@ void ThreadSafeArena::InitializeWithPolicy(const AllocationPolicy& policy) {
} }
new (p) AllocationPolicy{policy}; new (p) AllocationPolicy{policy};
// Low bits store flags, so they mustn't be overwritten. // Low bits store flags, so they mustn't be overwritten.
ABSL_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3); ABSL_DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(p) & 3);
alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p)); alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p));
ABSL_DCHECK_POLICY_FLAGS_(); ABSL_DCHECK_POLICY_FLAGS_();

Loading…
Cancel
Save