Remove call to protobuf FileDescriptor::syntax()

In the new version of protobuf FileDescriptor::syntax() should not
be used. Instead, protobuf API should be working with both,
proto2 and proto3 syntax.

Task-number: QTBUG-114833
Task-number: QTBUG-114962
Pick-to: 6.6
Change-Id: I86542cfcc0cc247f1e75e6d711e269ff3537f8a4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Konrad Kujawa 2023-06-29 13:33:09 +02:00
parent e66b3ac4c8
commit 2297f2da52
2 changed files with 2 additions and 11 deletions

View File

@ -30,13 +30,9 @@ QGrpcGenerator::~QGrpcGenerator() = default;
bool QGrpcGenerator::Generate(const FileDescriptor *file,
[[maybe_unused]] const std::string &parameter,
GeneratorContext *generatorContext,
std::string *error) const
[[maybe_unused]] std::string *error) const
{
assert(file != nullptr && generatorContext != nullptr);
if (file->syntax() != FileDescriptor::SYNTAX_PROTO3) {
*error = "Invalid proto used. qtgrpcgen only supports 'proto3' syntax";
return false;
}
return GenerateClientServices(file, generatorContext);
}

View File

@ -36,16 +36,11 @@ QProtobufGenerator::~QProtobufGenerator() = default;
bool QProtobufGenerator::Generate(const FileDescriptor *file,
[[maybe_unused]] const std::string &parameter,
GeneratorContext *generatorContext,
std::string *error) const
[[maybe_unused]] std::string *error) const
{
assert(file != nullptr);
assert(generatorContext != nullptr);
if (file->syntax() != FileDescriptor::SYNTAX_PROTO3) {
*error = "Invalid proto used. qtprotobufgen only supports 'proto3' syntax";
return false;
}
return GenerateMessages(file, generatorContext);
}