summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-10-14 10:08:58 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-10-18 08:53:27 +0000
commite652fa4d3e0f444f7a42d6a00cc39cf3ab79a6ec (patch)
treef92ea056fccf2bb9bc1ba975679e1c07eda49fc7 /src
parent8c2969ea86c4b38cbece5c1c2295e44dd5aa4f71 (diff)
Q_GLOBAL_STATIC: suppress warning about expressions in noexcept()
We use a simple statement to try and mark the holder as noexcept and that works for most cases (but not all). It triggers a warning when the expression is complex, though, like this in qlocale.cpp: Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, (new QLocalePrivate(defaultData(), defaultIndex()))) Pick-to: 6.2 Change-Id: Iea05060bc2c046928536fffd16adf4be6126d039 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobalstatic.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h
index 4aa496e7f6..49cebe1e61 100644
--- a/src/corelib/global/qglobalstatic.h
+++ b/src/corelib/global/qglobalstatic.h
@@ -122,6 +122,8 @@ struct QGlobalStatic
};
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
+ QT_WARNING_PUSH \
+ QT_WARNING_DISABLE_CLANG("-Wunevaluated-expression") \
namespace { namespace Q_QGS_ ## NAME { \
typedef TYPE Type; \
QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \
@@ -129,7 +131,8 @@ struct QGlobalStatic
} } \
static QGlobalStatic<TYPE, \
Q_QGS_ ## NAME::innerFunction, \
- Q_QGS_ ## NAME::guard> NAME;
+ Q_QGS_ ## NAME::guard> NAME; \
+ QT_WARNING_POP
#define Q_GLOBAL_STATIC(TYPE, NAME) \
Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())