Skip to content

Commit 63f6262

Browse files
jagub2copybara-github
authored andcommitted
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=#18193 from jagub2:raw_ptr_fix 4958e0f PiperOrigin-RevId: 676543711
1 parent bbbc7b9 commit 63f6262

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/google/protobuf/raw_ptr.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "google/protobuf/raw_ptr.h"
99

10+
#include <algorithm>
11+
1012
#include "absl/base/attributes.h"
1113
#include "absl/base/optimization.h"
1214

@@ -17,8 +19,8 @@ namespace google {
1719
namespace protobuf {
1820
namespace internal {
1921

20-
ABSL_CONST_INIT PROTOBUF_EXPORT
21-
ABSL_CACHELINE_ALIGNED const char kZeroBuffer[ABSL_CACHELINE_SIZE] = {};
22+
ABSL_CONST_INIT PROTOBUF_EXPORT ABSL_CACHELINE_ALIGNED const char
23+
kZeroBuffer[std::max(ABSL_CACHELINE_SIZE, 64)] = {};
2224

2325
} // namespace internal
2426
} // namespace protobuf

0 commit comments

Comments
 (0)