From dcbca2975f02581ba3e60430a5c231a49a99c24f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 25 Jan 2021 17:30:11 +0100 Subject: Q_GLOBAL_STATIC - deal with static code analysers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Edward Welbourne --- src/corelib/global/qglobalstatic.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/global/qglobalstatic.h') 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); \ } \ -- cgit v1.2.3