Move warning suppression macros from qglobal.h to qcompilerdetection.h
Task-number: QTBUG-99313 Change-Id: I54f1c48591b448a7b697720018e565a8c865a18b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c201c5aedf
commit
d773fbe0dc
@ -1121,6 +1121,20 @@
|
|||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The body must be a statement:
|
||||||
|
#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP
|
||||||
|
|
||||||
|
// This macro can be used to calculate member offsets for types with a non standard layout.
|
||||||
|
// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
|
||||||
|
// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
|
||||||
|
// call in a macro that disables the compiler warning.
|
||||||
|
#define Q_OFFSETOF(Class, member) \
|
||||||
|
[]() -> size_t { \
|
||||||
|
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
|
||||||
|
return offsetof(Class, member); \
|
||||||
|
QT_WARNING_POP \
|
||||||
|
}()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Proper for-scoping in MIPSpro CC
|
Proper for-scoping in MIPSpro CC
|
||||||
*/
|
*/
|
||||||
|
@ -250,22 +250,8 @@ constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
|
|||||||
return static_cast<std::underlying_type_t<Enum>>(e);
|
return static_cast<std::underlying_type_t<Enum>>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The body must be a statement:
|
|
||||||
#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP
|
|
||||||
|
|
||||||
#define QT_MODULE(x)
|
#define QT_MODULE(x)
|
||||||
|
|
||||||
// This macro can be used to calculate member offsets for types with a non standard layout.
|
|
||||||
// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
|
|
||||||
// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
|
|
||||||
// call in a macro that disables the compiler warning.
|
|
||||||
#define Q_OFFSETOF(Class, member) \
|
|
||||||
[]() -> size_t { \
|
|
||||||
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
|
|
||||||
return offsetof(Class, member); \
|
|
||||||
QT_WARNING_POP \
|
|
||||||
}()
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
|
// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user