Skip to content

Commit

Permalink
dependencies: Bump protobuf to v27.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Aug 6, 2024
1 parent 39b07a9 commit 753b2c8
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ZLIB=1.3.1
abseil-cpp=20240722.0
Protobuf=v27.2
Protobuf=v27.3
Eigen=3.4.0
Re2=2024-04-01
CoinUtils=2.11.6
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ git_repository(
# This statement defines the @com_google_protobuf repo.
git_repository(
name = "com_google_protobuf",
patches = ["//patches:protobuf-v27.2.patch"],
patches = ["//patches:protobuf-v27.3.patch"],
patch_args = ["-p1"],
tag = "v27.2",
tag = "v27.3",
remote = "https://github.com/protocolbuffers/protobuf.git",
)
# Load common dependencies.
Expand Down
2 changes: 1 addition & 1 deletion bazel/notebook_requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
absl-py==2.0.0
immutabledict==3.0.0
numpy==1.26.4
protobuf==5.27.2
protobuf==5.27.3
requests==2.32.0
scipy==1.11.3

Expand Down
4 changes: 2 additions & 2 deletions bazel/notebook_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# bazel run //bazel:notebook_requirements.update
Expand Down Expand Up @@ -230,7 +230,7 @@ prompt-toolkit==3.0.39
# via
# ipython
# jupyter-console
protobuf==5.27.2
protobuf==5.27.3
# via
# -r bazel/notebook_requirements.in
# mypy-protobuf
Expand Down
2 changes: 1 addition & 1 deletion bazel/ortools_requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
absl-py==2.0.0
immutabledict==3.0.0
numpy==1.26.4
protobuf==5.27.2
protobuf==5.27.3
requests==2.32.0
scipy==1.11.3

Expand Down
4 changes: 2 additions & 2 deletions bazel/ortools_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# bazel run //bazel:ortools_requirements.update
Expand Down Expand Up @@ -45,7 +45,7 @@ platformdirs==3.10.0
# via
# black
# virtualenv
protobuf==5.27.2
protobuf==5.27.3
# via
# -r bazel/ortools_requirements.in
# mypy-protobuf
Expand Down
4 changes: 2 additions & 2 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ if(BUILD_Protobuf)
FetchContent_Declare(
Protobuf
GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
GIT_TAG "v27.2"
GIT_TAG "v27.3"
GIT_SHALLOW TRUE
GIT_SUBMODULES ""
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v27.2.patch")
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v27.3.patch")
FetchContent_MakeAvailable(Protobuf)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
Expand Down
4 changes: 2 additions & 2 deletions cmake/host.CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ set(protobuf_WITH_ZLIB OFF)
FetchContent_Declare(
protobuf
GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
GIT_TAG "v27.2"
GIT_TAG "v27.3"
GIT_SUBMODULES ""
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/@PATCHES_PATH@/protobuf-v27.2.patch")
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/@PATCHES_PATH@/protobuf-v27.3.patch")
FetchContent_MakeAvailable(protobuf)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
2 changes: 1 addition & 1 deletion ortools/dotnet/Google.OrTools-full.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.2"/>
<PackageReference Include="Google.Protobuf" Version="3.27.3"/>
</ItemGroup>

<!-- Need to add required runtime dependencies so Meta-Project will pull runtime Nuget(s) -->
Expand Down
2 changes: 1 addition & 1 deletion ortools/dotnet/Google.OrTools-local.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.2"/>
<PackageReference Include="Google.Protobuf" Version="3.27.3"/>
</ItemGroup>

<!-- Need to add required runtime dependencies so Meta-Project will pull runtime Nuget(s) -->
Expand Down
2 changes: 1 addition & 1 deletion ortools/java/pom-full.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.27.2</version>
<version>4.27.3</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion ortools/java/pom-local.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.27.2</version>
<version>4.27.3</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion ortools/java/pom.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.26.1</version>
<version>4.27.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
2 changes: 1 addition & 1 deletion ortools/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ setup(
'absl-py >= 2.0.0',
'numpy >= 1.13.3',
'pandas >= 2.0.0',
'protobuf >= 5.27.2',
'protobuf >= 5.27.3',
'immutabledict >= 3.0.0',
],
package_data={
Expand Down
2 changes: 1 addition & 1 deletion patches/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
exports_files([
"abseil-cpp-20240722.0.patch",
"highs.patch",
"protobuf-v27.2.patch",
"protobuf-v27.3.patch",
"pybind11_abseil.patch",
"pybind11_bazel.patch",
"pybind11_protobuf.patch",
Expand Down
56 changes: 1 addition & 55 deletions patches/protobuf-v27.2.patch → patches/protobuf-v27.3.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b51e9722..33c1021d4 100644
index 807ef014..8937d5eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ else (BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -54,57 +54,3 @@ index 9b51e9722..33c1021d4 100644
${protobuf_BINARY_DIR}
# Support #include-ing other top-level directories, i.e. upb_generator.
${protobuf_SOURCE_DIR}
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
index 4fec7dc13..afb6f846a 100644
--- a/src/google/protobuf/port.h
+++ b/src/google/protobuf/port.h
@@ -49,31 +49,35 @@ inline PROTOBUF_ALWAYS_INLINE void StrongPointer(T* var) {
#endif
}

-// Similar to the overload above, but optimized for constant inputs.
+#if defined(__x86_64__) && defined(__linux__) && !defined(__APPLE__) && \
+ !defined(__ANDROID__) && defined(__clang__) && __clang_major__ >= 19
+// Optimized implementation for clang where we can generate a relocation without
+// adding runtime instructions.
template <typename T, T ptr>
inline PROTOBUF_ALWAYS_INLINE void StrongPointer() {
-#if defined(__x86_64__) && defined(__linux__) && !defined(__APPLE__) && \
- !defined(__ANDROID__) && defined(__clang__) && __clang_major__ >= 19 && \
- !defined(PROTOBUF_INTERNAL_TEMPORARY_STRONG_POINTER_OPT_OUT)
// This injects a relocation in the code path without having to run code, but
// we can only do it with a newer clang.
asm(".reloc ., BFD_RELOC_NONE, %p0" ::"Ws"(ptr));
-#else
- StrongPointer(ptr);
-#endif
}

template <typename T>
inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() {
- constexpr auto ptr = T::template GetStrongPointerForType<T>();
-#if defined(__cpp_nontype_template_args) && \
- __cpp_nontype_template_args >= 201411L
- // We can only use `ptr` as a template parameter since C++17
+ static constexpr auto ptr = T::template GetStrongPointerForType<T>();
return StrongPointer<decltype(ptr), ptr>();
-#else
- return StrongPointer(ptr);
-#endif
}
+#else // .reloc
+// Portable fallback. It usually generates a single LEA instruction or
+// equivalent.
+template <typename T, T ptr>
+inline PROTOBUF_ALWAYS_INLINE void StrongPointer() {
+ StrongPointer(ptr);
+}
+
+template <typename T>
+inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() {
+ return StrongPointer(T::template GetStrongPointerForType<T>());
+}
+#endif // .reloc


// See comments on `AllocateAtLeast` for information on size returning new.

0 comments on commit 753b2c8

Please sign in to comment.