summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobalstatic.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-01-25 17:30:11 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2021-01-27 10:30:26 +0100
commitdcbca2975f02581ba3e60430a5c231a49a99c24f (patch)
treec11db7ee1a05c6c5280d1e08eda2bc4a7fc98bd0 /src/corelib/global/qglobalstatic.h
parentbf7b1a2aa83ce631879914cb98133e32b20f0104 (diff)
Q_GLOBAL_STATIC - deal with static code analysers
At least some of them don't like the fact we have classes with non-trivial destructors but trivial move/copy constructors - disable them explicitly, hopefully those analysers are smart enough to stop complaining. Change-Id: I285711a2d21bff89661af928ba326ecd5b69823f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r--src/corelib/global/qglobalstatic.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h
index a0dfd462fd..674a2aea65 100644
--- a/src/corelib/global/qglobalstatic.h
+++ b/src/corelib/global/qglobalstatic.h
@@ -79,9 +79,11 @@ enum GuardValues {
Q_GLOBAL_STATIC_INTERNAL_DECORATION Type *innerFunction() \
{ \
struct HolderBase { \
+ HolderBase() = default; \
~HolderBase() noexcept \
{ if (guard.loadRelaxed() == QtGlobalStatic::Initialized) \
guard.storeRelaxed(QtGlobalStatic::Destroyed); } \
+ Q_DISABLE_COPY_MOVE(HolderBase) \
}; \
static struct Holder : public HolderBase { \
Type value; \
@@ -112,10 +114,12 @@ QT_BEGIN_NAMESPACE
if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { \
d = new Type ARGS; \
static struct Cleanup { \
+ Cleanup() = default; \
~Cleanup() { \
delete d; \
guard.storeRelaxed(QtGlobalStatic::Destroyed); \
} \
+ Q_DISABLE_COPY_MOVE(Cleanup) \
} cleanup; \
guard.storeRelease(QtGlobalStatic::Initialized); \
} \