From b94ba71cf7d1d3ff5f8eb85a649ab3b752b5d386 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Sat, 12 Aug 2023 15:24:54 +0200 Subject: [PATCH] Do not return error if the .proto file contain no type declarations The missing message or enum declarations shouldn't lead to an error when running protobuf generator. This only means that the .proto file needs no processing. Pick-to: 6.5 6.6 Change-Id: I80c81ebd04024c1e08883b8a0b9cf572b0c3aa1d Reviewed-by: Tatiana Borisova --- src/tools/qtprotobufgen/qprotobufgenerator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/qtprotobufgen/qprotobufgenerator.cpp b/src/tools/qtprotobufgen/qprotobufgenerator.cpp index 4327afe7..d03ba473 100644 --- a/src/tools/qtprotobufgen/qprotobufgenerator.cpp +++ b/src/tools/qtprotobufgen/qprotobufgenerator.cpp @@ -386,9 +386,9 @@ bool QProtobufGenerator::GenerateMessages(const FileDescriptor *file, assert(file != nullptr); assert(generatorContext != nullptr); - if (file->message_type_count() <= 0 && file->enum_type_count() <= 0) { - return false; - } + if (file->message_type_count() <= 0 && file->enum_type_count() <= 0) + return true; + GenerateHeader(file, generatorContext); GenerateSources(file, generatorContext); return true;