Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
protobuf-c
Commits
dbfbfeeb
Unverified
Commit
dbfbfeeb
authored
Jan 18, 2025
by
Robert Edmonds
Committed by
GitHub
Jan 18, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #711 from protobuf-c/edmonds/google-protobuf-26-fixes
Chase compatibility issues with Google protobuf >= 26.0
parents
428b7297
a4d04806
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
protoc-c/c_file.cc
protoc-c/c_file.cc
+1
-8
protoc-c/c_generator.h
protoc-c/c_generator.h
+6
-0
protoc-c/c_helpers.h
protoc-c/c_helpers.h
+14
-10
No files found.
protoc-c/c_file.cc
View file @
dbfbfeeb
...
@@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {}
...
@@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {}
void
FileGenerator
::
GenerateHeader
(
io
::
Printer
*
printer
)
{
void
FileGenerator
::
GenerateHeader
(
io
::
Printer
*
printer
)
{
std
::
string
filename_identifier
=
FilenameIdentifier
(
file_
->
name
());
std
::
string
filename_identifier
=
FilenameIdentifier
(
file_
->
name
());
int
min_header_version
=
1000000
;
const
int
min_header_version
=
1003000
;
#if GOOGLE_PROTOBUF_VERSION >= 4023000
if
(
FileDescriptorLegacy
(
file_
).
syntax
()
==
FileDescriptorLegacy
::
SYNTAX_PROTO3
)
{
#else
if
(
file_
->
syntax
()
==
FileDescriptor
::
SYNTAX_PROTO3
)
{
#endif
min_header_version
=
1003000
;
}
// Generate top of header.
// Generate top of header.
printer
->
Print
(
printer
->
Print
(
...
...
protoc-c/c_generator.h
View file @
dbfbfeeb
...
@@ -93,6 +93,12 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerator {
...
@@ -93,6 +93,12 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerator {
const
std
::
string
&
parameter
,
const
std
::
string
&
parameter
,
OutputDirectory
*
output_directory
,
OutputDirectory
*
output_directory
,
std
::
string
*
error
)
const
;
std
::
string
*
error
)
const
;
#if GOOGLE_PROTOBUF_VERSION >= 5026000
uint64_t
GetSupportedFeatures
()
const
{
return
0
;
}
Edition
GetMinimumEdition
()
const
{
return
Edition
::
EDITION_PROTO2
;
}
Edition
GetMaximumEdition
()
const
{
return
Edition
::
EDITION_PROTO3
;
}
#endif
};
};
}
// namespace c
}
// namespace c
...
...
protoc-c/c_helpers.h
View file @
dbfbfeeb
...
@@ -70,10 +70,6 @@
...
@@ -70,10 +70,6 @@
#include <protobuf-c/protobuf-c.pb.h>
#include <protobuf-c/protobuf-c.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/printer.h>
#if GOOGLE_PROTOBUF_VERSION >= 4023000
# include <google/protobuf/descriptor_legacy.h>
#endif
namespace
google
{
namespace
google
{
namespace
protobuf
{
namespace
protobuf
{
namespace
compiler
{
namespace
compiler
{
...
@@ -173,13 +169,21 @@ struct NameIndex
...
@@ -173,13 +169,21 @@ struct NameIndex
int
compare_name_indices_by_name
(
const
void
*
,
const
void
*
);
int
compare_name_indices_by_name
(
const
void
*
,
const
void
*
);
// Return the syntax version of the file containing the field.
// Return the syntax version of the file containing the field.
// This wrapper is needed to be able to compile against protobuf2.
inline
int
FieldSyntax
(
const
FieldDescriptor
*
field
)
{
inline
int
FieldSyntax
(
const
FieldDescriptor
*
field
)
{
#if GOOGLE_PROTOBUF_VERSION >= 4023000
auto
proto
=
FileDescriptorProto
();
return
FileDescriptorLegacy
(
field
->
file
()).
syntax
()
==
FileDescriptorLegacy
::
SYNTAX_PROTO3
?
3
:
2
;
field
->
file
()
->
CopyTo
(
&
proto
);
#else
return
field
->
file
()
->
syntax
()
==
FileDescriptor
::
SYNTAX_PROTO3
?
3
:
2
;
if
(
proto
.
has_syntax
())
{
#endif
auto
syntax
=
proto
.
syntax
();
assert
(
syntax
==
"proto2"
||
syntax
==
"proto3"
);
if
(
syntax
==
"proto2"
)
{
return
2
;
}
else
if
(
syntax
==
"proto3"
)
{
return
3
;
}
}
return
2
;
}
}
// Work around changes in protobuf >= 22.x without breaking compilation against
// Work around changes in protobuf >= 22.x without breaking compilation against
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment