45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
From 66574f3fd85a205eb7c90b790477d5415364209e Mon Sep 17 00:00:00 2001
|
|
From: Steve Peters <scpeters@openrobotics.org>
|
|
Date: Sat, 24 Jun 2023 22:15:42 -0700
|
|
Subject: [PATCH] Use FileDescriptorLegacy for deprecated syntax()
|
|
|
|
---
|
|
protoc-c/c_file.cc | 2 +-
|
|
protoc-c/c_helpers.h | 3 ++-
|
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
|
|
index 59c1824e..4b60b889 100644
|
|
--- a/protoc-c/c_file.cc
|
|
+++ b/protoc-c/c_file.cc
|
|
@@ -119,7 +119,7 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
|
|
|
|
int min_header_version = 1000000;
|
|
#if defined(HAVE_PROTO3)
|
|
- if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
|
|
+ if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
|
|
min_header_version = 1003000;
|
|
}
|
|
#endif
|
|
diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h
|
|
index 7598a4e1..87deea24 100644
|
|
--- a/protoc-c/c_helpers.h
|
|
+++ b/protoc-c/c_helpers.h
|
|
@@ -67,6 +67,7 @@
|
|
#include <vector>
|
|
#include <sstream>
|
|
#include <google/protobuf/descriptor.h>
|
|
+#include <google/protobuf/descriptor_legacy.h>
|
|
#include <protobuf-c/protobuf-c.pb.h>
|
|
#include <google/protobuf/io/printer.h>
|
|
|
|
@@ -172,7 +173,7 @@ int compare_name_indices_by_name(const void*, const void*);
|
|
// This wrapper is needed to be able to compile against protobuf2.
|
|
inline int FieldSyntax(const FieldDescriptor* field) {
|
|
#ifdef HAVE_PROTO3
|
|
- return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
|
|
+ return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2;
|
|
#else
|
|
return 2;
|
|
#endif
|