FileGenerator::GenerateHeader(): Set min_header_version unconditionally

Previously, we were conditionally trying to set `min_header_version` to
the lowest possible value, and relying on a "legacy" Google interface to
determine the file descriptor's syntax version as part of that
determination.

Instead, simply bump the minimum version to 1003000 (1.3.0). This
release was almost 7 years ago. In practice protobuf-c users should not
be shipping pre-compiled .pb-c.c/.pb-c.h files, anyway.
This commit is contained in:
Robert Edmonds 2024-03-20 21:48:10 -04:00
parent 5c13d7dfe9
commit e3acc96ca2

View File

@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {}
void FileGenerator::GenerateHeader(io::Printer* printer) {
std::string filename_identifier = FilenameIdentifier(file_->name());
int min_header_version = 1000000;
#if GOOGLE_PROTOBUF_VERSION >= 4023000
if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
#else
if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
#endif
min_header_version = 1003000;
}
const int min_header_version = 1003000;
// Generate top of header.
printer->Print(