MSYS2-packages/protobuf/0001-constant-initializer.patch
2023-09-15 19:30:18 +02:00

27 lines
1.4 KiB
Diff

--- protobuf-21.12/src/google/protobuf/port_def.inc.orig 2022-12-13 01:03:12.000000000 +0100
+++ protobuf-21.12/src/google/protobuf/port_def.inc 2023-09-15 19:26:43.043423700 +0200
@@ -638,7 +638,7 @@
#ifdef PROTOBUF_CONSTINIT
#error PROTOBUF_CONSTINIT was previously defined
#endif
-#if defined(__cpp_constinit) && !defined(_MSC_VER)
+#if defined(__cpp_constinit) && !defined(_MSC_VER) && !defined(__CYGWIN__)
#define PROTOBUF_CONSTINIT constinit
#define PROTOBUF_CONSTEXPR constexpr
// Some older Clang versions incorrectly raise an error about
@@ -646,12 +646,12 @@
// higher seem to work, except that XCode 12.5.1 shows the error even though it
// uses Clang 12.0.5.
// Clang-cl on Windows raises error also.
-#elif !defined(_MSC_VER) && __has_cpp_attribute(clang::require_constant_initialization) && \
+#elif !defined(_MSC_VER) && !defined(__CYGWIN__) && __has_cpp_attribute(clang::require_constant_initialization) && \
((defined(__APPLE__) && __clang_major__ >= 13) || \
(!defined(__APPLE__) && __clang_major__ >= 12))
#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
#define PROTOBUF_CONSTEXPR constexpr
-#elif PROTOBUF_GNUC_MIN(12, 2)
+#elif PROTOBUF_GNUC_MIN(12, 2) && !defined(__CYGWIN__)
#define PROTOBUF_CONSTINIT __constinit
#define PROTOBUF_CONSTEXPR constexpr
// MSVC 17 currently seems to raise an error about constant-initialized pointers.