git: 5af723cd1493 - main - math/or-tools: Fix build with protobuf 26+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Sep 2024 20:25:23 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=5af723cd1493d19113585c731ee85d339dcd5779
commit 5af723cd1493d19113585c731ee85d339dcd5779
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-09-15 20:03:23 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-15 20:11:53 +0000
math/or-tools: Fix build with protobuf 26+
---
math/or-tools/files/patch-protobuf | 46 ++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/math/or-tools/files/patch-protobuf b/math/or-tools/files/patch-protobuf
new file mode 100644
index 000000000000..1556807c41e2
--- /dev/null
+++ b/math/or-tools/files/patch-protobuf
@@ -0,0 +1,46 @@
+--- ortools/base/file.cc.orig 2023-11-13 09:51:25 UTC
++++ ortools/base/file.cc
+@@ -224,7 +224,8 @@ class NoOpErrorCollector : public google::protobuf::io
+ namespace {
+ class NoOpErrorCollector : public google::protobuf::io::ErrorCollector {
+ public:
+- void AddError(int line, int column, const std::string& message) override {}
++ void RecordError(int /*line*/, int /*column*/,
++ absl::string_view /*message*/) override {}
+ };
+ } // namespace
+
+--- ortools/util/file_util.cc.orig 2023-11-13 09:51:25 UTC
++++ ortools/util/file_util.cc
+@@ -137,7 +137,7 @@ bool WriteProtoToFile(absl::string_view filename,
+ case ProtoWriteFormat::kJson: {
+ google::protobuf::util::JsonPrintOptions options;
+ options.add_whitespace = true;
+- options.always_print_primitive_fields = true;
++ options.always_print_fields_with_no_presence = true;
+ options.preserve_proto_field_names = true;
+ if (!google::protobuf::util::MessageToJsonString(proto, &output_string,
+ options)
+--- ortools/util/parse_proto.cc.orig 2023-11-13 09:51:25 UTC
++++ ortools/util/parse_proto.cc
+@@ -36,11 +36,16 @@ class TextFormatErrorCollector : public google::protob
+ TextFormatErrorCollector() = default;
+ ~TextFormatErrorCollector() override = default;
+
+- void AddError(int line, int column, const std::string& message) override {
+- collected_errors_.push_back({false, line, column, message});
++ void RecordError(const int line, const int column,
++ absl::string_view message) override {
++ collected_errors_.push_back(
++ {/*warning=*/false, line, column, std::string(message)});
+ }
+- void AddWarning(int line, int column, const std::string& message) override {
+- collected_errors_.push_back({true, line, column, message});
++
++ void RecordWarning(const int line, const int column,
++ absl::string_view message) override {
++ collected_errors_.push_back(
++ {/*warning=*/true, line, column, std::string(message)});
+ }
+
+ // Returns a string listing each collected error. When an error is associated