From 63f6262c93edfef482011cfdc9df014e376ace69 Mon Sep 17 00:00:00 2001 From: Jakub Date: Thu, 19 Sep 2024 13:33:50 -0700 Subject: [PATCH] fix raw_ptr.cc on exotic architectures (#18193) I was working with an exotic architecture where ABSL_CACHELINE_SIZE of abseil was less than 64, so I got a compilation error about redefined symbols. I think the cc file should be adapted to the header file, so here is my change. Closes #18193 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/18193 from jagub2:raw_ptr_fix 4958e0f85ef877ba4028de8e67f6e9bb74bcf6a2 PiperOrigin-RevId: 676543711 --- src/google/protobuf/raw_ptr.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/raw_ptr.cc b/src/google/protobuf/raw_ptr.cc index cffe79c5020e..8b7ce15c8c38 100644 --- a/src/google/protobuf/raw_ptr.cc +++ b/src/google/protobuf/raw_ptr.cc @@ -7,6 +7,8 @@ #include "google/protobuf/raw_ptr.h" +#include + #include "absl/base/attributes.h" #include "absl/base/optimization.h" @@ -17,8 +19,8 @@ namespace google { namespace protobuf { namespace internal { -ABSL_CONST_INIT PROTOBUF_EXPORT - ABSL_CACHELINE_ALIGNED const char kZeroBuffer[ABSL_CACHELINE_SIZE] = {}; +ABSL_CONST_INIT PROTOBUF_EXPORT ABSL_CACHELINE_ALIGNED const char + kZeroBuffer[std::max(ABSL_CACHELINE_SIZE, 64)] = {}; } // namespace internal } // namespace protobuf