[protobuf] Fix constinit with clang cl (#48425)

This commit is contained in:
Riccardo Ressi 2025-11-26 04:47:40 +01:00 committed by GitHub
parent 9aee6e968f
commit 4c5ae6b55f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,14 @@
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index a512b4843..31f1f5a12 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -678,6 +678,9 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
# define PROTOBUF_CONSTINIT
# define PROTOBUF_CONSTEXPR constexpr
# endif
+#elif defined(_MSC_VER) && defined(__clang__)
+# define PROTOBUF_CONSTINIT
+# define PROTOBUF_CONSTEXPR constexpr
#else
# if defined(__cpp_constinit) && !defined(__CYGWIN__)
# define PROTOBUF_CONSTINIT constinit

View File

@ -11,6 +11,7 @@ vcpkg_from_github(
fix-install-dirs.patch
fix-mingw-tail-call.patch
fix-abseil.patch
fix-constinit-with-clang-cl.patch
)
string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" protobuf_BUILD_PROTOC_BINARIES)

View File

@ -1,7 +1,7 @@
{
"name": "protobuf",
"version": "5.29.5",
"port-version": 2,
"port-version": 3,
"description": "Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.",
"homepage": "https://github.com/protocolbuffers/protobuf",
"license": "BSD-3-Clause",

View File

@ -7770,7 +7770,7 @@
},
"protobuf": {
"baseline": "5.29.5",
"port-version": 2
"port-version": 3
},
"protobuf-c": {
"baseline": "1.5.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a8fdd2b1b4283409700152a6ac8639c005d1c103",
"version": "5.29.5",
"port-version": 3
},
{
"git-tree": "b71ee5bb425cd832ed1615601bd92573f07e9206",
"version": "5.29.5",