mirror of https://github.com/qt/qtgrpc.git
Replace has_optional_keyword for old libprotoc versions
Use the old syntax-based check if libprotoc version is less than
3.12.
Amends dd04edf72f
Pick-to: 6.6
Task-number: QTBUG-115693
Change-Id: Ia411f70337a14843ff320b7c75ab140f5021f2f6
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
This commit is contained in:
parent
03ccff3aa7
commit
4a4cf48a0d
|
|
@ -12,6 +12,8 @@
|
|||
#include "utils.h"
|
||||
#include "options.h"
|
||||
|
||||
#include "qtprotocdefs.h"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <numeric>
|
||||
|
|
@ -286,7 +288,12 @@ void QProtobufGenerator::GenerateHeader(const FileDescriptor *file,
|
|||
+ "/" + field->message_type()->name());
|
||||
qtTypesSet.insert(field->message_type()->file()->package());
|
||||
}
|
||||
#ifdef HAVE_PROTOBUF_SYNC_PIPER
|
||||
if (field->has_optional_keyword())
|
||||
#else
|
||||
if (file->syntax() == FileDescriptor::SYNTAX_PROTO2 && field->is_optional()
|
||||
&& !field->containing_oneof())
|
||||
#endif
|
||||
hasOptionalFields = true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue