summaryrefslogtreecommitdiffstats
diff options
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-04 15:48:08 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-04 15:48:08 +0200
commitfdd48419cfd74cee300747e7a5d9779cc3f657be (patch)
tree67df9a1ef329b679e726efbbb7e4565408275a5d
parent999e35ec96b9c5ded9c20610898bd486b45ebba9 (diff)
parentae2b13aa1709796e7a5243d878b85de92b2f4a19 (diff)
Merge tag 'v6.5.5-lts-lgpl' into 6.56.5
Qt 6.5.5-lts-lgpl release
-rw-r--r--.cmake.conf2
-rw-r--r--dependencies.yaml4
-rw-r--r--examples/grpc/magic8ball/clientservice.cpp1
-rw-r--r--src/grpc/qabstractgrpcclient.cpp12
-rw-r--r--src/grpc/qgrpcchannel.cpp1
-rw-r--r--src/grpc/qgrpcoperation.cpp4
-rw-r--r--src/protobuf/doc/src/qtprotobuf.qdoc2
-rw-r--r--src/protobuf/qabstractprotobufserializer.cpp2
-rw-r--r--src/protobuf/qabstractprotobufserializer.h2
-rw-r--r--src/protobuf/qprotobuflazymessagepointer.h4
-rw-r--r--src/protobuf/qprotobufmessage.cpp2
-rw-r--r--src/protobuf/qprotobufmessage.h2
-rw-r--r--src/protobuf/qprotobufmessage_p.h2
-rw-r--r--src/protobuf/qprotobufobject.h2
-rw-r--r--src/protobuf/qprotobufselfcheckiterator.h2
-rw-r--r--src/protobuf/qprotobufserializer.cpp3
-rw-r--r--src/protobuf/qprotobufserializer.h2
-rw-r--r--src/protobuf/qprotobufserializer_p.h2
-rw-r--r--src/protobuf/qtprotobufglobal.h2
-rw-r--r--src/protobuf/qtprotobuflogging.cpp2
-rw-r--r--src/protobuf/qtprotobuflogging_p.h2
-rw-r--r--src/protobuf/qtprotobuftypes.cpp9
-rw-r--r--src/protobuf/qtprotobuftypes.h2
-rw-r--r--src/tools/doc/src/qtprotobufgen.qdoc2
-rw-r--r--src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake10
-rw-r--r--src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake34
-rw-r--r--src/tools/qtprotobufgen/enumdeclarationprinter.cpp2
-rw-r--r--src/tools/qtprotobufgen/messagedeclarationprinter.cpp2
-rw-r--r--src/tools/qtprotobufgen/messagedefinitionprinter.cpp2
-rw-r--r--src/tools/qtprotoccommon/commontemplates.cpp25
-rw-r--r--src/tools/qtprotoccommon/commontemplates.h2
-rw-r--r--src/tools/qtprotoccommon/generatorcommon.cpp10
-rw-r--r--src/tools/qtprotoccommon/generatorcommon.h3
-rw-r--r--tests/auto/grpcgen/tst_qtgrpcgen.cpp11
-rw-r--r--tests/auto/protobuf/enums/tst_protobuf_serialization_enumtypes.cpp12
-rw-r--r--tests/auto/protobuf/syntax/syntax.proto34
-rw-r--r--tests/auto/protobuf/syntax/tst_protobuf_syntax.cpp6
-rw-r--r--tests/auto/protobufgen/tst_qtprotobufgen.cpp15
38 files changed, 158 insertions, 80 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 39f8d82b..ac0f20fc 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1,4 +1,4 @@
-set(QT_REPO_MODULE_VERSION "6.5.4")
+set(QT_REPO_MODULE_VERSION "6.5.5")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1")
diff --git a/dependencies.yaml b/dependencies.yaml
index 3e718a62..7a34e83f 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,7 +1,7 @@
dependencies:
../tqtc-qtbase:
- ref: 8ff0b254e4c3db81254782262d827f7831d15f6b
+ ref: fdf57f5df57e7d12cf871699d857a71acf272e0c
required: true
../tqtc-qtdeclarative:
- ref: 9edb471d3a35b3dc40def86c395789086edaa983
+ ref: 7ac842cba18be081ac835bf40ac475ec4c47d30b
required: false
diff --git a/examples/grpc/magic8ball/clientservice.cpp b/examples/grpc/magic8ball/clientservice.cpp
index 786d6434..8c725bed 100644
--- a/examples/grpc/magic8ball/clientservice.cpp
+++ b/examples/grpc/magic8ball/clientservice.cpp
@@ -3,6 +3,7 @@
#include "clientservice.h"
+#include <QDebug>
#include <QGrpcHttp2Channel>
#include <QGrpcInsecureChannelCredentials>
diff --git a/src/grpc/qabstractgrpcclient.cpp b/src/grpc/qabstractgrpcclient.cpp
index 1d329e98..b71c27a9 100644
--- a/src/grpc/qabstractgrpcclient.cpp
+++ b/src/grpc/qabstractgrpcclient.cpp
@@ -85,6 +85,18 @@ static QString threadSafetyWarning(QLatin1StringView methodName)
message received from server-stream.
*/
+/*!
+ \fn void QAbstractGrpcClient::errorOccurred(const QGrpcStatus &status);
+
+ Indicates that an error occurred during serialization.
+
+ This signal is emitted when an error with \a status occurs in the channel
+ or during serialization.
+
+ \sa QGrpcOperation::errorOccurred
+*/
+
+
class QAbstractGrpcClientPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QAbstractGrpcClient)
diff --git a/src/grpc/qgrpcchannel.cpp b/src/grpc/qgrpcchannel.cpp
index 9be88c00..db1d0829 100644
--- a/src/grpc/qgrpcchannel.cpp
+++ b/src/grpc/qgrpcchannel.cpp
@@ -14,6 +14,7 @@
#include <grpcpp/channel.h>
#include <grpcpp/create_channel.h>
+#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/client_unary_call.h>
#include <grpcpp/impl/codegen/rpc_method.h>
diff --git a/src/grpc/qgrpcoperation.cpp b/src/grpc/qgrpcoperation.cpp
index d240823b..e77aeaa4 100644
--- a/src/grpc/qgrpcoperation.cpp
+++ b/src/grpc/qgrpcoperation.cpp
@@ -19,7 +19,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn template <typename T> T QGrpcOperation::read() const;
+ \fn template <typename T> T QGrpcOperation::read() const
Reads message from raw byte array stored in QGrpcCallReply.
@@ -43,6 +43,8 @@ QT_BEGIN_NAMESPACE
This signal is emitted when error with \a status occurs in channel
or during serialization.
+
+ \sa QAbstractGrpcClient::errorOccurred
*/
class QGrpcOperationPrivate : public QObjectPrivate
diff --git a/src/protobuf/doc/src/qtprotobuf.qdoc b/src/protobuf/doc/src/qtprotobuf.qdoc
index ea4f6382..bafa83e2 100644
--- a/src/protobuf/doc/src/qtprotobuf.qdoc
+++ b/src/protobuf/doc/src/qtprotobuf.qdoc
@@ -39,7 +39,7 @@
\li No need to integrate generated code into project tree manually.
\li Convenient serialization and deserialization API.
\li Integrated properties mechanism for generated protobuf messages.
- \li Integrated gRPC-client support (see \l {Qt GRPC}{QtGrpc module}).
+ \li Integrated gRPC-client support (see \l {Qt GRPC}{Qt GRPC module}).
\endlist
\section2 Incoming features
diff --git a/src/protobuf/qabstractprotobufserializer.cpp b/src/protobuf/qabstractprotobufserializer.cpp
index 959aa858..9ad89a9e 100644
--- a/src/protobuf/qabstractprotobufserializer.cpp
+++ b/src/protobuf/qabstractprotobufserializer.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include <QtProtobuf/qabstractprotobufserializer.h>
diff --git a/src/protobuf/qabstractprotobufserializer.h b/src/protobuf/qabstractprotobufserializer.h
index cc8b6f20..c64a29d7 100644
--- a/src/protobuf/qabstractprotobufserializer.h
+++ b/src/protobuf/qabstractprotobufserializer.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QABSTRACTPROTOBUFSERIALIZER_H
#define QABSTRACTPROTOBUFSERIALIZER_H
diff --git a/src/protobuf/qprotobuflazymessagepointer.h b/src/protobuf/qprotobuflazymessagepointer.h
index 18825e66..e0a0d1ed 100644
--- a/src/protobuf/qprotobuflazymessagepointer.h
+++ b/src/protobuf/qprotobuflazymessagepointer.h
@@ -1,6 +1,6 @@
// Copyright (C) 2020 Alexey Edelev <semlanik@gmail.com>
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QPROTOBUFLAZYMESSAGEPOINTER_H
#define QPROTOBUFLAZYMESSAGEPOINTER_H
@@ -9,8 +9,6 @@
#include <QtProtobuf/qprotobufmessage.h>
-#include <type_traits>
-
QT_BEGIN_NAMESPACE
namespace QtProtobufPrivate {
class QProtobufLazyMessagePointerBase
diff --git a/src/protobuf/qprotobufmessage.cpp b/src/protobuf/qprotobufmessage.cpp
index 04ab4f24..613b486b 100644
--- a/src/protobuf/qprotobufmessage.cpp
+++ b/src/protobuf/qprotobufmessage.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "qprotobufmessage_p.h"
#include "qprotobufmessage.h"
diff --git a/src/protobuf/qprotobufmessage.h b/src/protobuf/qprotobufmessage.h
index 9ad9a652..22e3696f 100644
--- a/src/protobuf/qprotobufmessage.h
+++ b/src/protobuf/qprotobufmessage.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef Q_PROTOBUF_MESSAGE_H
#define Q_PROTOBUF_MESSAGE_H
diff --git a/src/protobuf/qprotobufmessage_p.h b/src/protobuf/qprotobufmessage_p.h
index fb82358b..09565477 100644
--- a/src/protobuf/qprotobufmessage_p.h
+++ b/src/protobuf/qprotobufmessage_p.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef Q_PROTOBUF_MESSAGE_P_H
#define Q_PROTOBUF_MESSAGE_P_H
diff --git a/src/protobuf/qprotobufobject.h b/src/protobuf/qprotobufobject.h
index f36babe3..eaf7ae37 100644
--- a/src/protobuf/qprotobufobject.h
+++ b/src/protobuf/qprotobufobject.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QPROTOBUFOBJECT_H
#define QPROTOBUFOBJECT_H
diff --git a/src/protobuf/qprotobufselfcheckiterator.h b/src/protobuf/qprotobufselfcheckiterator.h
index 94707aac..b06a7204 100644
--- a/src/protobuf/qprotobufselfcheckiterator.h
+++ b/src/protobuf/qprotobufselfcheckiterator.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QPROTOBUFSELFCHECKITERATOR_H
#define QPROTOBUFSELFCHECKITERATOR_H
diff --git a/src/protobuf/qprotobufserializer.cpp b/src/protobuf/qprotobufserializer.cpp
index 85514a15..ad6e145e 100644
--- a/src/protobuf/qprotobufserializer.cpp
+++ b/src/protobuf/qprotobufserializer.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>, Viktor Kopp <vifactor@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "qprotobufserializer.h"
#include "qprotobufserializer_p.h"
@@ -70,7 +70,6 @@ QtProtobufPrivate::SerializationHandler QtProtobufPrivate::findHandler(QMetaType
\since 6.5
\brief The QProtobufSerializer class is interface that represents
basic functions for serialization/deserialization.
- \reentrant
The QProtobufSerializer class registers serializers/deserializers for
classes implementing a protobuf message, inheriting QProtobufMessage. These
diff --git a/src/protobuf/qprotobufserializer.h b/src/protobuf/qprotobufserializer.h
index 181afe4b..c171db67 100644
--- a/src/protobuf/qprotobufserializer.h
+++ b/src/protobuf/qprotobufserializer.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QPROTOBUFSERIALIZER_H
#define QPROTOBUFSERIALIZER_H
diff --git a/src/protobuf/qprotobufserializer_p.h b/src/protobuf/qprotobufserializer_p.h
index 339988fe..6e6e89d5 100644
--- a/src/protobuf/qprotobufserializer_p.h
+++ b/src/protobuf/qprotobufserializer_p.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>, Viktor Kopp <vifactor@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QPROTOBUFSERIALIZER_P_H
#define QPROTOBUFSERIALIZER_P_H
diff --git a/src/protobuf/qtprotobufglobal.h b/src/protobuf/qtprotobufglobal.h
index cbe9376d..1ee1a0c9 100644
--- a/src/protobuf/qtprotobufglobal.h
+++ b/src/protobuf/qtprotobufglobal.h
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QTPROTOBUFGLOBAL_H
#define QTPROTOBUFGLOBAL_H
diff --git a/src/protobuf/qtprotobuflogging.cpp b/src/protobuf/qtprotobuflogging.cpp
index 5a85d7e6..4c289f53 100644
--- a/src/protobuf/qtprotobuflogging.cpp
+++ b/src/protobuf/qtprotobuflogging.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "qtprotobuflogging_p.h"
diff --git a/src/protobuf/qtprotobuflogging_p.h b/src/protobuf/qtprotobuflogging_p.h
index f68db319..b3430e7e 100644
--- a/src/protobuf/qtprotobuflogging_p.h
+++ b/src/protobuf/qtprotobuflogging_p.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QTPROTOBUFLOGGING_P_H
#define QTPROTOBUFLOGGING_P_H
diff --git a/src/protobuf/qtprotobuftypes.cpp b/src/protobuf/qtprotobuftypes.cpp
index 68c0f7f8..e702b99f 100644
--- a/src/protobuf/qtprotobuftypes.cpp
+++ b/src/protobuf/qtprotobuftypes.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include <QtProtobuf/qtprotobufglobal.h>
@@ -11,7 +11,6 @@
#include <QtProtobuf/private/qtprotobuflogging_p.h>
#include "qtprotobuftypes.h"
-#include "qprotobufobject.h"
#include <mutex>
#include <limits>
@@ -318,8 +317,8 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QtProtobuf::sfixed64, QtProtobuf_sfixed64)
\value Varint int32, int64, uint32, uint64, sint32, sint64, bool, enum
\value Fixed64 fixed64, sfixed64, double
\value LengthDelimited string, bytes, embedded messages, packed repeated fields
- \value StartGroup groups. Deprecated in proto syntax 3. Not supported by QtProtobuf.
- \value EndGroup groups. Deprecated in proto syntax 3. Not supported by QtProtobuf.
+ \value StartGroup groups. Deprecated in proto syntax 3. Not supported by Qt Protobuf.
+ \value EndGroup groups. Deprecated in proto syntax 3. Not supported by Qt Protobuf.
\value Fixed32 fixed32, sfixed32, float
\sa {https://protobuf.dev/programming-guides/encoding} {encoding}
@@ -349,7 +348,7 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QtProtobuf::sfixed64, QtProtobuf_sfixed64)
/*!
\namespace QtProtobuf
- \brief The QtProtobuf namespace contains type aliases and classes needed to support QtProtobuf.
+ \brief The QtProtobuf namespace contains type aliases and classes needed to support Qt Protobuf.
\inmodule QtProtobuf
*/
diff --git a/src/protobuf/qtprotobuftypes.h b/src/protobuf/qtprotobuftypes.h
index c14b7be9..6814c7a6 100644
--- a/src/protobuf/qtprotobuftypes.h
+++ b/src/protobuf/qtprotobuftypes.h
@@ -1,6 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef QTPROTOBUFTYPES_H
#define QTPROTOBUFTYPES_H
diff --git a/src/tools/doc/src/qtprotobufgen.qdoc b/src/tools/doc/src/qtprotobufgen.qdoc
index 8ad8c915..912bd172 100644
--- a/src/tools/doc/src/qtprotobufgen.qdoc
+++ b/src/tools/doc/src/qtprotobufgen.qdoc
@@ -8,7 +8,7 @@
\inmodule QtProtobuf
\ingroup explanation
-The \c qtprotobufgen tool can be used to generate QtProtobuf classes from a
+The \c qtprotobufgen tool can be used to generate Qt Protobuf classes from a
protobuf schema. The tool is provided by the CMake \c {Qt6::ProtobufTools}
package. It works as an extension to Google's \c protoc tool.
diff --git a/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake b/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake
index ec64f50d..8891ae32 100644
--- a/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake
+++ b/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake
@@ -174,12 +174,10 @@ function(qt6_add_grpc target type)
set(generated_headers "${generated_files}")
list(FILTER generated_headers INCLUDE REGEX ".+\\.h$")
- if(is_static OR is_shared)
- set_target_properties(${target}
- PROPERTIES
- AUTOMOC ON
- )
- endif()
+ set_target_properties(${target}
+ PROPERTIES
+ AUTOMOC ON
+ )
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${target}
diff --git a/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake b/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake
index b4df0a8b..7f526c23 100644
--- a/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake
+++ b/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake
@@ -79,7 +79,8 @@ function(_qt_internal_protoc_generate target generator output_directory)
get_filename_component(output_directory "${output_directory}" REALPATH)
get_target_property(is_generator_imported ${QT_CMAKE_EXPORT_NAMESPACE}::${generator} IMPORTED)
- if(QT_INTERNAL_AVOID_USING_PROTOBUF_TMP_OUTPUT_DIR OR is_generator_imported)
+ if(QT_INTERNAL_AVOID_USING_PROTOBUF_TMP_OUTPUT_DIR OR is_generator_imported
+ OR NOT CMAKE_GENERATOR MATCHES "^Ninja")
set(tmp_output_directory "${output_directory}")
else()
set(tmp_output_directory "${output_directory}/.tmp")
@@ -131,7 +132,8 @@ function(_qt_internal_protoc_generate target generator output_directory)
"${proto_includes_string}"
)
- unset(extra_copy_commands)
+ set(extra_copy_commands "")
+ set(temporary_files "")
if(NOT tmp_output_directory STREQUAL output_directory)
foreach(f IN LISTS generated_files)
get_filename_component(filename "${f}" NAME)
@@ -143,11 +145,17 @@ function(_qt_internal_protoc_generate target generator output_directory)
calling _qt_internal_protoc_generate"
)
endif()
+ list(APPEND temporary_files "${tmp_output_directory}/${f_rel}")
list(APPEND extra_copy_commands COMMAND
${CMAKE_COMMAND} -E copy_if_different "${tmp_output_directory}/${f_rel}" "${f}")
endforeach()
endif()
+ set(byproducts "")
+ if(temporary_files)
+ set(byproducts BYPRODUCTS ${temporary_files})
+ endif()
+
add_custom_command(OUTPUT ${generated_files}
COMMAND ${CMAKE_COMMAND}
-DPROTOC_EXECUTABLE=$<TARGET_FILE:WrapProtoc::WrapProtoc>
@@ -157,6 +165,7 @@ function(_qt_internal_protoc_generate target generator output_directory)
-P
${__qt_protobuf_macros_module_base_dir}/QtProtocCommandWrapper.cmake
${extra_copy_commands}
+ ${byproducts}
WORKING_DIRECTORY ${output_directory}
DEPENDS
${QT_CMAKE_EXPORT_NAMESPACE}::${generator}
@@ -346,16 +355,19 @@ function(qt6_add_protobuf target)
target_sources(${target} PRIVATE ${generated_headers} ${generated_sources})
- if(is_static OR is_shared)
- set_target_properties(${target}
- PROPERTIES
- AUTOMOC ON
- )
- endif()
+ set_target_properties(${target}
+ PROPERTIES
+ AUTOMOC ON
+ )
- if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- target_compile_options(${target}
- PRIVATE "/Zc:__cplusplus" "/permissive-" "/bigobj")
+ if(WIN32)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ target_compile_options(${target}
+ PRIVATE "/Zc:__cplusplus" "/permissive-" "/bigobj")
+ elseif(MINGW)
+ target_compile_options(${target}
+ PRIVATE "-Wa,-mbig-obj")
+ endif()
endif()
target_link_libraries(${target} PRIVATE
diff --git a/src/tools/qtprotobufgen/enumdeclarationprinter.cpp b/src/tools/qtprotobufgen/enumdeclarationprinter.cpp
index c9a93b48..91def71e 100644
--- a/src/tools/qtprotobufgen/enumdeclarationprinter.cpp
+++ b/src/tools/qtprotobufgen/enumdeclarationprinter.cpp
@@ -36,7 +36,7 @@ void EnumDeclarationPrinter::printEnum()
int numValues = m_descriptor->value_count();
for (int j = 0; j < numValues; ++j) {
const EnumValueDescriptor *valueDescr = m_descriptor->value(j);
- m_printer->Print({ { "enumvalue", utils::capitalizeAsciiName(valueDescr->name()) },
+ m_printer->Print({ { "enumvalue", common::qualifiedCppName(valueDescr->name()) },
{ "value", std::to_string(valueDescr->number()) } },
CommonTemplates::EnumFieldTemplate());
}
diff --git a/src/tools/qtprotobufgen/messagedeclarationprinter.cpp b/src/tools/qtprotobufgen/messagedeclarationprinter.cpp
index 03b51ba2..f97c5773 100644
--- a/src/tools/qtprotobufgen/messagedeclarationprinter.cpp
+++ b/src/tools/qtprotobufgen/messagedeclarationprinter.cpp
@@ -302,7 +302,7 @@ void MessageDeclarationPrinter::printQEnums()
Indent();
for (int j = 0; j < enumDescr->value_count(); ++j) {
const auto *valueDescr = enumDescr->value(j);
- m_printer->Print({ { "enumvalue", utils::capitalizeAsciiName(valueDescr->name()) },
+ m_printer->Print({ { "enumvalue", common::qualifiedCppName(valueDescr->name()) },
{ "value", std::to_string(valueDescr->number()) } },
CommonTemplates::EnumFieldTemplate());
}
diff --git a/src/tools/qtprotobufgen/messagedefinitionprinter.cpp b/src/tools/qtprotobufgen/messagedefinitionprinter.cpp
index 30841c68..9ac98969 100644
--- a/src/tools/qtprotobufgen/messagedefinitionprinter.cpp
+++ b/src/tools/qtprotobufgen/messagedefinitionprinter.cpp
@@ -263,7 +263,7 @@ void MessageDefinitionPrinter::printInitializationList()
break;
case FieldDescriptor::TYPE_ENUM:
propertyMap["initializer"] = propertyMap["scope_type"]
- + "::" + field->enum_type()->value(0)->name();
+ + "::" +common::qualifiedCppName(field->enum_type()->value(0)->name());
break;
default:
propertyMap["initializer"] = "";
diff --git a/src/tools/qtprotoccommon/commontemplates.cpp b/src/tools/qtprotoccommon/commontemplates.cpp
index 2a6f874b..0314e550 100644
--- a/src/tools/qtprotoccommon/commontemplates.cpp
+++ b/src/tools/qtprotoccommon/commontemplates.cpp
@@ -39,6 +39,31 @@ const std::vector<std::string> &CommonTemplates::ListOfQmlExceptions()
return vec;
}
+const std::set<std::string_view> &CommonTemplates::ListOfCppExceptions()
+{
+ static std::set<std::string_view> cppExceptions{
+ "NULL", "alignas", "alignof", "and", "and_eq",
+ "asm", "auto", "bitand", "bitor", "bool",
+ "break", "case", "catch", "char", "class",
+ "compl", "const", "constexpr", "const_cast", "continue",
+ "decltype", "default", "delete", "do", "double",
+ "dynamic_cast", "else", "enum", "explicit", "export",
+ "extern", "false", "float", "for", "friend",
+ "goto", "if", "inline", "int", "long",
+ "mutable", "namespace", "new", "noexcept", "not",
+ "not_eq", "nullptr", "operator", "or", "or_eq",
+ "private", "protected", "public", "register", "reinterpret_cast",
+ "return", "short", "signed", "sizeof", "static",
+ "static_assert", "static_cast", "struct", "switch", "template",
+ "this", "thread_local", "throw", "true", "try",
+ "typedef", "typeid", "typename", "union", "unsigned",
+ "using", "virtual", "void", "volatile", "wchar_t",
+ "while", "xor", "xor_eq"
+ };
+
+ return cppExceptions;
+}
+
const char *CommonTemplates::DefaultProtobufIncludesTemplate()
{
return "#include <QtCore/QMetaType>\n"
diff --git a/src/tools/qtprotoccommon/commontemplates.h b/src/tools/qtprotoccommon/commontemplates.h
index 7aa8aea0..9b499b4e 100644
--- a/src/tools/qtprotoccommon/commontemplates.h
+++ b/src/tools/qtprotoccommon/commontemplates.h
@@ -6,6 +6,7 @@
#define QTPROTOCCOMMON_TEMPLATES_H
#include <unordered_map>
+#include <set>
#include <string>
#include <google/protobuf/descriptor.h>
@@ -15,6 +16,7 @@ class CommonTemplates
{
public:
static const std::vector<std::string> &ListOfQmlExceptions();
+ static const std::set<std::string_view> &ListOfCppExceptions();
static const char *ProtoSuffix();
static const char *DefaultProtobufIncludesTemplate();
static const char *QmlProtobufIncludesTemplate();
diff --git a/src/tools/qtprotoccommon/generatorcommon.cpp b/src/tools/qtprotoccommon/generatorcommon.cpp
index 8405e2cd..e5ad369a 100644
--- a/src/tools/qtprotoccommon/generatorcommon.cpp
+++ b/src/tools/qtprotoccommon/generatorcommon.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include <algorithm>
+#include <string_view>
using namespace ::google::protobuf;
using namespace ::google::protobuf::io;
@@ -379,7 +380,7 @@ PropertyMap common::producePropertyMap(const FieldDescriptor *field, const Descr
scriptable = "false";
}
- std::string propertyName = qualifiedName(utils::deCapitalizeAsciiName(field->camelcase_name()));
+ std::string propertyName = qualifiedCppName(qualifiedQmlName(utils::deCapitalizeAsciiName(field->camelcase_name())));
std::string propertyNameCap = utils::capitalizeAsciiName(propertyName);
propertyMap["property_name"] = propertyName;
@@ -407,7 +408,7 @@ PropertyMap common::producePropertyMap(const FieldDescriptor *field, const Descr
return propertyMap;
}
-std::string common::qualifiedName(const std::string &name)
+std::string common::qualifiedQmlName(const std::string &name)
{
std::string fieldName(name);
const std::vector<std::string> &searchExceptions = CommonTemplates::ListOfQmlExceptions();
@@ -417,6 +418,11 @@ std::string common::qualifiedName(const std::string &name)
return fieldName;
}
+std::string common::qualifiedCppName(const std::string &name)
+{
+ return utils::contains(CommonTemplates::ListOfCppExceptions(), name) ? name + "_" : name;
+}
+
bool common::isLocalEnum(const EnumDescriptor *type, const Descriptor *scope)
{
assert(type != nullptr);
diff --git a/src/tools/qtprotoccommon/generatorcommon.h b/src/tools/qtprotoccommon/generatorcommon.h
index 009c3b99..81225e5a 100644
--- a/src/tools/qtprotoccommon/generatorcommon.h
+++ b/src/tools/qtprotoccommon/generatorcommon.h
@@ -118,7 +118,8 @@ struct common {
static MethodMap produceMethodMap(const MethodDescriptor *method, const std::string &scope);
static TypeMap produceServiceTypeMap(const ServiceDescriptor *service, const Descriptor *scope);
static TypeMap produceClientTypeMap(const ServiceDescriptor *service, const Descriptor *scope);
- static std::string qualifiedName(const std::string &name);
+ static std::string qualifiedQmlName(const std::string &name);
+ static std::string qualifiedCppName(const std::string &name);
static bool isLocalEnum(const EnumDescriptor *type, const google::protobuf::Descriptor *scope);
static EnumVisibility enumVisibility(const EnumDescriptor *type, const Descriptor *scope);
static bool hasQmlAlias(const FieldDescriptor *field);
diff --git a/tests/auto/grpcgen/tst_qtgrpcgen.cpp b/tests/auto/grpcgen/tst_qtgrpcgen.cpp
index d8da2e9f..5fe319cc 100644
--- a/tests/auto/grpcgen/tst_qtgrpcgen.cpp
+++ b/tests/auto/grpcgen/tst_qtgrpcgen.cpp
@@ -20,15 +20,10 @@ const QLatin1StringView grpcGenQtprotobufKey(" --plugin=protoc-gen-qtgrpc=");
const QLatin1StringView optKey(" --qtgrpc_opt=");
const QLatin1StringView outputKey(" --qtgrpc_out=");
const QLatin1StringView includeKey(" -I");
-#if defined(PROTOC_EXECUTABLE)
-const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE));
-#else
-#if defined(Q_OS_WIN)
-const QLatin1StringView protocolBufferCompiler("protoc.exe");
-#else
-const QLatin1StringView protocolBufferCompiler("protoc");
-#endif
+#ifndef PROTOC_EXECUTABLE
+# error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable
#endif
+const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE));
#if defined(Q_OS_WIN)
const QLatin1StringView qtgrpcgen("/qtgrpcgen.exe");
#else
diff --git a/tests/auto/protobuf/enums/tst_protobuf_serialization_enumtypes.cpp b/tests/auto/protobuf/enums/tst_protobuf_serialization_enumtypes.cpp
index d34c2dae..e5ed4779 100644
--- a/tests/auto/protobuf/enums/tst_protobuf_serialization_enumtypes.cpp
+++ b/tests/auto/protobuf/enums/tst_protobuf_serialization_enumtypes.cpp
@@ -10,11 +10,10 @@
class QtProtobufEnumTypesSerializationTest : public QObject
{
Q_OBJECT
-public:
+private slots:
void SimpleEnumMessageSerializeTest();
void RepeatedEnumMessageTest();
-private slots:
void init() {
m_serializer.reset(new QProtobufSerializer);
}
@@ -23,6 +22,7 @@ private:
};
using namespace qtprotobufnamespace::tests;
+using namespace Qt::Literals::StringLiterals;
void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
{
@@ -30,7 +30,7 @@ void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
test.setLocalEnum(SimpleEnumMessage::LOCAL_ENUM_VALUE2);
QByteArray result = test.serialize(m_serializer.get());
QCOMPARE(result.size(), 2);
- QCOMPARE(result.toHex().toStdString().c_str(), "0802");
+ QCOMPARE(result.toHex(), "0802"_ba);
}
void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
@@ -44,12 +44,10 @@ void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
RepeatedEnumMessage::LOCAL_ENUM_VALUE2,
RepeatedEnumMessage::LOCAL_ENUM_VALUE3});
QByteArray result = msg.serialize(m_serializer.get());
- QCOMPARE(result.toHex().toStdString().c_str(),
- "0a06000102010203");
+ QCOMPARE(result.toHex(), "0a06000102010203"_ba);
msg.setLocalEnumList({});
result = msg.serialize(m_serializer.get());
- QCOMPARE(result.toHex().toStdString().c_str(),
- "");
+ QCOMPARE(result.toHex(), ""_ba);
}
QTEST_MAIN(QtProtobufEnumTypesSerializationTest)
diff --git a/tests/auto/protobuf/syntax/syntax.proto b/tests/auto/protobuf/syntax/syntax.proto
index 62717002..6c40ffb4 100644
--- a/tests/auto/protobuf/syntax/syntax.proto
+++ b/tests/auto/protobuf/syntax/syntax.proto
@@ -75,8 +75,42 @@ message MessageEnumReserved {
enumValue2 = 2;
}
+ enum UpperCaseEnum {
+ EnumValue0 = 0;
+ EnumValue1 = 1;
+ EnumValue2 = 2;
+ }
+
enum UnderScoreEnum {
_enumUnderscoreValue0 = 0;
_EnumUnderscoreValue1 = 1;
}
}
+
+message CppKeywords {
+ bool private = 1;
+ bool if = 2;
+ bool else = 3;
+ bool for = 4;
+ bool while = 5;
+ bool switch = 6;
+ bool case = 7;
+ bool do = 8;
+ bool goto = 9;
+}
+
+message int {
+ enum long {
+ bool = 0;
+ char = 1;
+ float = 2;
+ double = 3;
+ unsigned = 4;
+ }
+
+ long enum = 1;
+}
+
+message if {
+ bool else = 1;
+}
diff --git a/tests/auto/protobuf/syntax/tst_protobuf_syntax.cpp b/tests/auto/protobuf/syntax/tst_protobuf_syntax.cpp
index e3ce997c..c06f22d9 100644
--- a/tests/auto/protobuf/syntax/tst_protobuf_syntax.cpp
+++ b/tests/auto/protobuf/syntax/tst_protobuf_syntax.cpp
@@ -93,9 +93,9 @@ void QtProtobufSyntaxTest::LowerCaseEnumTest()
}
}
QVERIFY(simpleEnum.isValid());
- QCOMPARE(simpleEnum.key(0), "EnumValue0");
- QCOMPARE(simpleEnum.key(1), "EnumValue1");
- QCOMPARE(simpleEnum.key(2), "EnumValue2");
+ QCOMPARE(simpleEnum.key(0), "enumValue0");
+ QCOMPARE(simpleEnum.key(1), "enumValue1");
+ QCOMPARE(simpleEnum.key(2), "enumValue2");
}
QTEST_MAIN(QtProtobufSyntaxTest)
diff --git a/tests/auto/protobufgen/tst_qtprotobufgen.cpp b/tests/auto/protobufgen/tst_qtprotobufgen.cpp
index dc01d3a9..be7a6525 100644
--- a/tests/auto/protobufgen/tst_qtprotobufgen.cpp
+++ b/tests/auto/protobufgen/tst_qtprotobufgen.cpp
@@ -21,15 +21,10 @@ const QLatin1StringView protocGenQtprotobufKey(" --plugin=protoc-gen-qtprotobuf=
const QLatin1StringView optKey(" --qtprotobuf_opt=");
const QLatin1StringView outputKey(" --qtprotobuf_out=");
const QLatin1StringView includeKey(" -I");
-#if defined(PROTOC_EXECUTABLE)
-const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE));
-#else
-#if defined(Q_OS_WIN)
-const QLatin1StringView protocolBufferCompiler("protoc.exe");
-#else
-const QLatin1StringView protocolBufferCompiler("protoc");
-#endif
+#ifndef PROTOC_EXECUTABLE
+# error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable
#endif
+const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE));
#if defined(Q_OS_WIN)
const QLatin1StringView qtprotobufgen("/qtprotobufgen.exe");
#else
@@ -246,8 +241,8 @@ void tst_qtprotobufgen::cmakeGeneratedFile()
QFile expectedResultFile(m_expectedResult + folder + fileName + extension);
QFile generatedFile(m_cmakeGenerated + folder + fileName + extension);
- QVERIFY(expectedResultFile.exists());
- QVERIFY(generatedFile.exists());
+ QVERIFY2(expectedResultFile.exists(), qPrintable(expectedResultFile.fileName()));
+ QVERIFY2(generatedFile.exists(), qPrintable(expectedResultFile.fileName()));
QVERIFY2(expectedResultFile.open(QIODevice::ReadOnly | QIODevice::Text),
msgCannotReadFile(expectedResultFile).constData());