From dc7ad6c1b7321b1d8ff3755b0bd8a6210f47bbc7 Mon Sep 17 00:00:00 2001 From: tenzap <46226844+tenzap@users.noreply.github.com> Date: Thu, 25 Nov 2021 04:36:31 +0100 Subject: [PATCH] Fix syntax issue & add a missing header (#7160) * Fix syntax to prevent compilation issue Fix build failure with AppleClang 7 & 8. Error was: src/core/CustomData.cpp:30:41: error: default initialization of an object of const type 'const CustomData::CustomDataItem' without a user-provided default constructor static const CustomData::CustomDataItem NULL_ITEM; ^ {} src/core/Metadata.cpp:32:39: error: default initialization of an object of const type 'const Metadata::CustomIconData' without a user-provided default constructor static const Metadata::CustomIconData NULL_ICON; ^ src/core/Metadata.cpp:32:48: note: add an explicit initializer to initialize 'NULL_ICON' static const Metadata::CustomIconData NULL_ICON; ^ {} * Add missing QUuid header Fixes this compilation issue with LLVM clang 9, possibly also due to an old QT5 tests/TestTools.cpp:96:39: error: incomplete type 'QUuid' named in nested name specifier auto validUuid = Tools::uuidToHex(QUuid::createUuid()); ^~~~~~~ /opt/local/libexec/qt5/lib/QtCore.framework/Headers/qmetatype.h:1887:1: note: forward declaration of 'QUuid' QT_FOR_EACH_STATIC_CORE_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) ^ /opt/local/libexec/qt5/lib/QtCore.framework/Headers/qmetatype.h:108:18: note: expanded from macro 'QT_FOR_EACH_STATIC_CORE_CLASS' F(QUuid, 30, QUuid) \ ^ tests/TestTools.cpp:101:40: error: incomplete type 'QUuid' named in nested name specifier auto nonHexUuid = Tools::uuidToHex(QUuid::createUuid()).replace(0, 1, 'p'); ^~~~~~~ /opt/local/libexec/qt5/lib/QtCore.framework/Headers/qmetatype.h:1887:1: note: forward declaration of 'QUuid' QT_FOR_EACH_STATIC_CORE_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) ^ /opt/local/libexec/qt5/lib/QtCore.framework/Headers/qmetatype.h:108:18: note: expanded from macro 'QT_FOR_EACH_STATIC_CORE_CLASS' F(QUuid, 30, QUuid) \ ^ --- src/core/CustomData.cpp | 2 +- src/core/Metadata.cpp | 2 +- tests/TestTools.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/CustomData.cpp b/src/core/CustomData.cpp index 97cbf9800..a9c5bcd3b 100644 --- a/src/core/CustomData.cpp +++ b/src/core/CustomData.cpp @@ -27,7 +27,7 @@ const QString CustomData::BrowserLegacyKeyPrefix = QStringLiteral("Public Key: " const QString CustomData::ExcludeFromReportsLegacy = QStringLiteral("KnownBad"); // Fallback item for return by reference -static const CustomData::CustomDataItem NULL_ITEM; +static const CustomData::CustomDataItem NULL_ITEM{}; CustomData::CustomData(QObject* parent) : ModifiableObject(parent) diff --git a/src/core/Metadata.cpp b/src/core/Metadata.cpp index a055bef6f..d88998057 100644 --- a/src/core/Metadata.cpp +++ b/src/core/Metadata.cpp @@ -29,7 +29,7 @@ const int Metadata::DefaultHistoryMaxItems = 10; const int Metadata::DefaultHistoryMaxSize = 6 * 1024 * 1024; // Fallback icon for return by reference -static const Metadata::CustomIconData NULL_ICON; +static const Metadata::CustomIconData NULL_ICON{}; Metadata::Metadata(QObject* parent) : ModifiableObject(parent) diff --git a/tests/TestTools.cpp b/tests/TestTools.cpp index edfeb5034..9e3dadc45 100644 --- a/tests/TestTools.cpp +++ b/tests/TestTools.cpp @@ -20,6 +20,7 @@ #include "core/Clock.h" #include +#include QTEST_GUILESS_MAIN(TestTools)