mirror of https://github.com/qt/qtgrpc.git
QProtobufGenerator: Fix deprecation warning for 'has_optional_keyword()'
... got deprecated in Protobuf v25.0-rc2 Warning states: ‘bool google::protobuf::FieldDescriptor::has_optional_keyword() const’ is deprecated: Syntax is deprecated in favor of editions, please use FieldDescriptor::has_presence instead. [-Wdeprecated-declarations] Change-Id: If33d214939ddf3f1018b875d0c47692690394f72 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
cea1abe16f
commit
8ebca7f46c
|
|
@ -196,12 +196,8 @@ 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
|
||||
|
||||
if (common::isOptionalField(field))
|
||||
hasOptionalFields = true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ bool common::isOneofField(const FieldDescriptor *field)
|
|||
bool common::isOptionalField(const FieldDescriptor *field)
|
||||
{
|
||||
#ifdef HAVE_PROTOBUF_SYNC_PIPER
|
||||
bool hasOptional = field->has_optional_keyword();
|
||||
bool hasOptional = field->has_presence() && !field->real_containing_oneof();
|
||||
#else
|
||||
bool hasOptional = file->syntax() == FileDescriptor::SYNTAX_PROTO2 && field->is_optional()
|
||||
&& !field->containing_oneof();
|
||||
|
|
|
|||
Loading…
Reference in New Issue