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) \
                 ^
This commit is contained in:
tenzap 2021-11-25 04:36:31 +01:00 committed by GitHub
parent 61e378077e
commit dc7ad6c1b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -27,7 +27,7 @@ const QString CustomData::BrowserLegacyKeyPrefix = QStringLiteral("Public Key: "
const QString CustomData::ExcludeFromReportsLegacy = QStringLiteral("KnownBad"); const QString CustomData::ExcludeFromReportsLegacy = QStringLiteral("KnownBad");
// Fallback item for return by reference // Fallback item for return by reference
static const CustomData::CustomDataItem NULL_ITEM; static const CustomData::CustomDataItem NULL_ITEM{};
CustomData::CustomData(QObject* parent) CustomData::CustomData(QObject* parent)
: ModifiableObject(parent) : ModifiableObject(parent)

View File

@ -29,7 +29,7 @@ const int Metadata::DefaultHistoryMaxItems = 10;
const int Metadata::DefaultHistoryMaxSize = 6 * 1024 * 1024; const int Metadata::DefaultHistoryMaxSize = 6 * 1024 * 1024;
// Fallback icon for return by reference // Fallback icon for return by reference
static const Metadata::CustomIconData NULL_ICON; static const Metadata::CustomIconData NULL_ICON{};
Metadata::Metadata(QObject* parent) Metadata::Metadata(QObject* parent)
: ModifiableObject(parent) : ModifiableObject(parent)

View File

@ -20,6 +20,7 @@
#include "core/Clock.h" #include "core/Clock.h"
#include <QTest> #include <QTest>
#include <QUuid>
QTEST_GUILESS_MAIN(TestTools) QTEST_GUILESS_MAIN(TestTools)