Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra/protobuf/fix_static_assert_fail_on_32bit.patch
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2023-02-13 23:15:20 +0200
committerErich Eckner <git@eckner.net>2023-02-14 06:14:04 +0100
commitf7dc0a31cf3d52cc5f0c73a5303021b23151b8f6 (patch)
tree36e9385c22fbc7e3847595c8cf4fe4ef6de85451 /extra/protobuf/fix_static_assert_fail_on_32bit.patch
parente8aa8914b276efd49eba297669afe04d3ccf311e (diff)
extra/protobuf: Fix static assert fail for 32 bit builds
Diffstat (limited to 'extra/protobuf/fix_static_assert_fail_on_32bit.patch')
-rw-r--r--extra/protobuf/fix_static_assert_fail_on_32bit.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/extra/protobuf/fix_static_assert_fail_on_32bit.patch b/extra/protobuf/fix_static_assert_fail_on_32bit.patch
new file mode 100644
index 00000000..d1ea6f51
--- /dev/null
+++ b/extra/protobuf/fix_static_assert_fail_on_32bit.patch
@@ -0,0 +1,26 @@
+--- a/src/google/protobuf/repeated_field.h 2022-12-13 02:03:12.000000000 +0200
++++ b/src/google/protobuf/repeated_field.h 2023-02-13 16:30:24.269977261 +0200
+@@ -73,18 +73,21 @@
+ class Message;
+
+ namespace internal {
++constexpr int max_size(const int a, const int b) {
++ return a > b ? a : b;
++}
+
+ template <typename T, int kRepHeaderSize>
+ constexpr int RepeatedFieldLowerClampLimit() {
+ // The header is padded to be at least `sizeof(T)` when it would be smaller
+ // otherwise.
+- static_assert(sizeof(T) <= kRepHeaderSize, "");
++ //static_assert(sizeof(T) <= kRepHeaderSize, "");
+ // We want to pad the minimum size to be a power of two bytes, including the
+ // header.
+ // The first allocation is kRepHeaderSize bytes worth of elements for a total
+ // of 2*kRepHeaderSize bytes.
+ // For an 8-byte header, we allocate 8 bool, 2 ints, or 1 int64.
+- return kRepHeaderSize / sizeof(T);
++ return max_size(kRepHeaderSize, sizeof(T)) / sizeof(T);
+ }
+
+ // kRepeatedFieldUpperClampLimit is the lowest signed integer value that