summaryrefslogtreecommitdiff
path: root/dev-libs/protobuf-c/files/protobuf-c-1.3.0-restore-protobuf-2-compatibility.patch
blob: 962341b6540d42810723a3db38e5e30fc3a1773b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 4302266b45303094616685c7997a6e6015ddadba Mon Sep 17 00:00:00 2001
From: Robert Edmonds <edmonds@users.noreply.github.com>
Date: Mon, 7 Aug 2017 12:31:55 -0400
Subject: [PATCH] Restore protobuf-2.x compatibility

The change in commit 712154b912de824741381c0bb26c2fbed54515a3 ("Bump
minimum required header version for proto3 syntax") uses functionality
only exposed by protobuf-3.x, breaking the build when compiling against
protobuf-2.x.

Since we still want to support building against protobuf-2.x, this
commit makes the proto3 syntax check in the file generator dependent on
building against protobuf-3.x.
---
 protoc-c/c_file.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
index 9851768..0f1d770 100644
--- a/protoc-c/c_file.cc
+++ b/protoc-c/c_file.cc
@@ -120,9 +120,11 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
   string filename_identifier = FilenameIdentifier(file_->name());
 
   int min_header_version = 1000000;
+#if defined(HAVE_PROTO3)
   if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
     min_header_version = 1003000;
   }
+#endif
 
   // Generate top of header.
   printer->Print(