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>
This commit is contained in:
parent
8c2969ea86
commit
e652fa4d3e
@ -122,6 +122,8 @@ struct QGlobalStatic
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
|
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
|
||||||
|
QT_WARNING_PUSH \
|
||||||
|
QT_WARNING_DISABLE_CLANG("-Wunevaluated-expression") \
|
||||||
namespace { namespace Q_QGS_ ## NAME { \
|
namespace { namespace Q_QGS_ ## NAME { \
|
||||||
typedef TYPE Type; \
|
typedef TYPE Type; \
|
||||||
QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \
|
QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \
|
||||||
@ -129,7 +131,8 @@ struct QGlobalStatic
|
|||||||
} } \
|
} } \
|
||||||
static QGlobalStatic<TYPE, \
|
static QGlobalStatic<TYPE, \
|
||||||
Q_QGS_ ## NAME::innerFunction, \
|
Q_QGS_ ## NAME::innerFunction, \
|
||||||
Q_QGS_ ## NAME::guard> NAME;
|
Q_QGS_ ## NAME::guard> NAME; \
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
#define Q_GLOBAL_STATIC(TYPE, NAME) \
|
#define Q_GLOBAL_STATIC(TYPE, NAME) \
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())
|
Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())
|
||||||
|
Loading…
Reference in New Issue
Block a user