QDS: Fix warnings for GCC 11.2

[[maybe_unused]] leads to warning: ‘maybe_unused’ attribute ignored [-Wattributes]
when compiling with g++, so we instead completely remove the declaration instead.

Change-Id: I00650f78d61a0da18e76cd65908fc4a2abda174a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-08-22 14:21:36 +02:00
parent 8e118e9d5e
commit 7f51ae7105
2 changed files with 19 additions and 4 deletions

View File

@@ -19,10 +19,15 @@ public:
using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>; using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>;
using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>; using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>;
#ifdef QDS_HAS_QMLDOM
QmlDocumentParser(ProjectStorage &storage, PathCache &pathCache) QmlDocumentParser(ProjectStorage &storage, PathCache &pathCache)
: m_storage{storage} : m_storage{storage}
, m_pathCache{pathCache} , m_pathCache{pathCache}
{} {}
#else
QmlDocumentParser(ProjectStorage &, PathCache &)
{}
#endif
Storage::Synchronization::Type parse(const QString &sourceContent, Storage::Synchronization::Type parse(const QString &sourceContent,
Storage::Synchronization::Imports &imports, Storage::Synchronization::Imports &imports,
@@ -31,7 +36,9 @@ public:
private: private:
// m_pathCache and m_storage are only used when compiled for QDS // m_pathCache and m_storage are only used when compiled for QDS
[[maybe_unused]] ProjectStorage &m_storage; #ifdef QDS_HAS_QMLDOM
[[maybe_unused]] PathCache &m_pathCache; ProjectStorage &m_storage;
PathCache &m_pathCache;
#endif
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -24,10 +24,15 @@ public:
using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>; using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>;
using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>; using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>;
#ifdef QDS_HAS_QMLDOM
QmlTypesParser(PathCache &pathCache, ProjectStorage &storage) QmlTypesParser(PathCache &pathCache, ProjectStorage &storage)
: m_pathCache{pathCache} : m_pathCache{pathCache}
, m_storage{storage} , m_storage{storage}
{} {}
#else
QmlTypesParser(PathCache &, ProjectStorage &)
{}
#endif
void parse(const QString &sourceContent, void parse(const QString &sourceContent,
Storage::Synchronization::Imports &imports, Storage::Synchronization::Imports &imports,
@@ -36,7 +41,10 @@ public:
private: private:
// m_pathCache and m_storage are only used when compiled for QDS // m_pathCache and m_storage are only used when compiled for QDS
[[maybe_unused]] PathCache &m_pathCache; #ifdef QDS_HAS_QMLDOM
[[maybe_unused]] ProjectStorage &m_storage; PathCache &m_pathCache;
ProjectStorage &m_storage;
#endif
}; };
} // namespace QmlDesigner } // namespace QmlDesigner