sync ports with The Matrix

This commit is contained in:
purplerain 2023-09-17 04:05:06 +00:00
parent 02776f1507
commit a0fe1892c0
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
885 changed files with 6817 additions and 4874 deletions

View file

@ -2,6 +2,7 @@ COMMENT = c protocol buffers
V = 1.4.1
DISTNAME = protobuf-c-$V
REVISION = 0
SHARED_LIBS = protobuf-c 2.0 # 1.0
@ -17,11 +18,12 @@ PERMIT_PACKAGE = Yes
WANTLIB = c m protobuf protoc pthread ${COMPILER_LIBCXX} z
COMPILER = base-clang ports-gcc
CXXFLAGS += -std=gnu++11
CXXFLAGS += -std=gnu++17
LIB_DEPENDS = devel/protobuf
CONFIGURE_STYLE = gnu
CONFIGURE_STYLE = autoconf
AUTOCONF_VERSION = 2.71
CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: build-cmake/CMakeLists.txt
--- build-cmake/CMakeLists.txt.orig
+++ build-cmake/CMakeLists.txt
@@ -88,7 +88,7 @@ if (MSVC AND NOT BUILD_SHARED_LIBS)
endif (MSVC AND NOT BUILD_SHARED_LIBS)
IF(BUILD_PROTOC)
-SET(CMAKE_CXX_STANDARD 11)
+SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
ADD_CUSTOM_COMMAND(OUTPUT protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h

View file

@ -0,0 +1,20 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -76,12 +76,8 @@ AC_ARG_ENABLE([protoc],
if test "x$enable_protoc" != "xno"; then
AC_LANG_PUSH([C++])
- AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
-
- PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0],
- [proto3_supported=yes],
- [PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])]
- )
+ AX_CXX_COMPILE_STDCXX(17, noext, mandatory)
+ PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0], [proto3_supported=yes])
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$save_CPPFLAGS $protobuf_CFLAGS"

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_bytes_field.h
--- protoc-c/c_bytes_field.h.orig
+++ protoc-c/c_bytes_field.h
@@ -87,8 +87,6 @@ class BytesFieldGenerator : public FieldGenerator {
private:
std::map<std::string, std::string> variables_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
};

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_enum_field.h
--- protoc-c/c_enum_field.h.orig
+++ protoc-c/c_enum_field.h
@@ -85,8 +85,6 @@ class EnumFieldGenerator : public FieldGenerator {
private:
std::map<std::string, std::string> variables_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
};

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_enum.h
--- protoc-c/c_enum.h.orig
+++ protoc-c/c_enum.h
@@ -106,8 +106,6 @@ class EnumGenerator {
private:
const EnumDescriptor* descriptor_;
std::string dllexport_decl_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
};
} // namespace c

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_extension.h
--- protoc-c/c_extension.h.orig
+++ protoc-c/c_extension.h
@@ -98,8 +98,6 @@ class ExtensionGenerator {
const FieldDescriptor* descriptor_;
std::string type_traits_;
std::string dllexport_decl_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
};
} // namespace c

View file

@ -0,0 +1,24 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_field.h
--- protoc-c/c_field.h.orig
+++ protoc-c/c_field.h
@@ -103,9 +103,6 @@ class FieldGenerator {
const std::string &type_macro,
const std::string &descriptor_addr) const;
const FieldDescriptor *descriptor_;
-
- private:
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
};
// Convenience class which constructs FieldGenerators for a Descriptor.
@@ -121,8 +118,6 @@ class FieldGeneratorMap {
std::unique_ptr<std::unique_ptr<FieldGenerator>[]> field_generators_;
static FieldGenerator* MakeGenerator(const FieldDescriptor* field);
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
} // namespace c

View file

@ -0,0 +1,17 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_file.cc
--- protoc-c/c_file.cc.orig
+++ protoc-c/c_file.cc
@@ -119,7 +119,11 @@ void FileGenerator::GenerateHeader(io::Printer* printe
int min_header_version = 1000000;
#if defined(HAVE_PROTO3)
+# if GOOGLE_PROTOBUF_VERSION >= 4023000
+ if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
+# else
if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
+#endif
min_header_version = 1003000;
}
#endif

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_file.h
--- protoc-c/c_file.h.orig
+++ protoc-c/c_file.h
@@ -103,8 +103,6 @@ class FileGenerator {
std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_;
std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_;
std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
};
} // namespace c

View file

@ -0,0 +1,15 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_generator.h
--- protoc-c/c_generator.h.orig
+++ protoc-c/c_generator.h
@@ -93,9 +93,6 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerato
const std::string& parameter,
OutputDirectory* output_directory,
std::string* error) const;
-
- private:
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CGenerator);
};
} // namespace c

View file

@ -0,0 +1,42 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_helpers.h
--- protoc-c/c_helpers.h.orig
+++ protoc-c/c_helpers.h
@@ -70,6 +70,10 @@
#include <protobuf-c/protobuf-c.pb.h>
#include <google/protobuf/io/printer.h>
+#if GOOGLE_PROTOBUF_VERSION >= 4023000
+# include <google/protobuf/descriptor_legacy.h>
+#endif
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -172,11 +176,25 @@ int compare_name_indices_by_name(const void*, const vo
// This wrapper is needed to be able to compile against protobuf2.
inline int FieldSyntax(const FieldDescriptor* field) {
#ifdef HAVE_PROTO3
+# if GOOGLE_PROTOBUF_VERSION >= 4023000
+ return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2;
+# else
return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
+# endif
#else
return 2;
#endif
}
+
+// Work around changes in protobuf >= 22.x without breaking compilation against
+// older protobuf versions.
+#if GOOGLE_PROTOBUF_VERSION >= 4022000
+# define GOOGLE_ARRAYSIZE ABSL_ARRAYSIZE
+# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ
+# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ
+# define GOOGLE_DCHECK_GE ABSL_DCHECK_GE
+# define GOOGLE_LOG ABSL_LOG
+#endif
} // namespace c
} // namespace compiler

View file

@ -0,0 +1,23 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_message.cc
--- protoc-c/c_message.cc.orig
+++ protoc-c/c_message.cc
@@ -499,7 +499,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool g
// NOTE: not supported by protobuf
vars["maybe_static"] = "";
vars["field_dv_ctype"] = "{ ... }";
- GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
+ GOOGLE_LOG(FATAL) << "Messages can't have default values!";
break;
case FieldDescriptor::CPPTYPE_STRING:
if (fd->type() == FieldDescriptor::TYPE_BYTES || opt.string_as_bytes())
@@ -521,7 +521,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool g
break;
}
default:
- GOOGLE_LOG(DFATAL) << "Unknown CPPTYPE";
+ GOOGLE_LOG(FATAL) << "Unknown CPPTYPE";
break;
}
if (!already_defined)

View file

@ -0,0 +1,16 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_message_field.h
--- protoc-c/c_message_field.h.orig
+++ protoc-c/c_message_field.h
@@ -82,10 +82,6 @@ class MessageFieldGenerator : public FieldGenerator {
void GenerateDescriptorInitializer(io::Printer* printer) const;
std::string GetDefaultValue(void) const;
void GenerateStaticInit(io::Printer* printer) const;
-
- private:
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
};

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_message.h
--- protoc-c/c_message.h.orig
+++ protoc-c/c_message.h
@@ -136,8 +136,6 @@ class MessageGenerator {
std::unique_ptr<std::unique_ptr<MessageGenerator>[]> nested_generators_;
std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_;
std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
};
} // namespace c

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_primitive_field.cc
--- protoc-c/c_primitive_field.cc.orig
+++ protoc-c/c_primitive_field.cc
@@ -143,7 +143,7 @@ std::string PrimitiveFieldGenerator::GetDefaultValue()
case FieldDescriptor::CPPTYPE_BOOL:
return descriptor_->default_value_bool() ? "1" : "0";
default:
- GOOGLE_LOG(DFATAL) << "unexpected CPPTYPE in c_primitive_field";
+ GOOGLE_LOG(FATAL) << "unexpected CPPTYPE in c_primitive_field";
return "UNEXPECTED_CPPTYPE";
}
}

View file

@ -0,0 +1,16 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_primitive_field.h
--- protoc-c/c_primitive_field.h.orig
+++ protoc-c/c_primitive_field.h
@@ -82,10 +82,6 @@ class PrimitiveFieldGenerator : public FieldGenerator
void GenerateDescriptorInitializer(io::Printer* printer) const;
std::string GetDefaultValue(void) const;
void GenerateStaticInit(io::Printer* printer) const;
-
- private:
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
};
} // namespace c

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_service.h
--- protoc-c/c_service.h.orig
+++ protoc-c/c_service.h
@@ -100,8 +100,6 @@ class ServiceGenerator {
const ServiceDescriptor* descriptor_;
std::map<std::string, std::string> vars_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator);
};
} // namespace c

View file

@ -0,0 +1,14 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_string_field.h
--- protoc-c/c_string_field.h.orig
+++ protoc-c/c_string_field.h
@@ -87,8 +87,6 @@ class StringFieldGenerator : public FieldGenerator {
private:
std::map<std::string, std::string> variables_;
-
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
};