Commit a4d04806 authored by Robert Edmonds's avatar Robert Edmonds

CGenerator: Do not claim to support editions

As detailed in https://github.com/protobuf-c/protobuf-c/pull/711, the
protobuf compiler apparently polices the values reported by a code
generator's GetMinimumEdition() / GetMaximumEdition() methods, if
GetSupportedFeatures() reports that it reports editions.

Returning `FEATURE_SUPPORTS_EDITIONS` broke the legacy `protoc-c`
command-line binary because that binary "registers" the protobuf-c code
generator as a built-in code generator, whereas `protoc-gen-c` (aka
`protoc --c_out=`) is a code generator plugin and the policing performed
by protobuf's `CommandLineInterface::SetupFeatureResolution()` method
apparently doesn't apply to plugins.

This commit prevents our min/max editions from being policed when
invoked as `protoc-c`.

Tested with protobuf 29.3.
parent a181fcdc
......@@ -95,7 +95,7 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerator {
std::string* error) const;
#if GOOGLE_PROTOBUF_VERSION >= 5026000
uint64_t GetSupportedFeatures() const { return CodeGenerator::FEATURE_SUPPORTS_EDITIONS; }
uint64_t GetSupportedFeatures() const { return 0; }
Edition GetMinimumEdition() const { return Edition::EDITION_PROTO2; }
Edition GetMaximumEdition() const { return Edition::EDITION_PROTO3; }
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment