gcc 11: Adjust pragma warning placement

Apparently, gcc's pragma warning logic has changed from 10 -> 11. For
gcc 11, we need to place the macro directly next to the the line which
triggers the warning.

Task-number: QTBUG-93360
Pick-to: 6.1
Change-Id: Ifaa6136050fe5b887660a8a0acf6938388f4f77d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Fabian Kosmale 2021-04-30 11:40:59 +02:00
parent c3c8b7083a
commit e16afd66fc
2 changed files with 16 additions and 0 deletions

View File

@ -1130,13 +1130,17 @@ private:
#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name) \ #define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name; QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name;
#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal) \ #define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name; QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name;
@ -1148,7 +1152,9 @@ private:
#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value) \ #define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value) \
static constexpr size_t _qt_property_##name##_offset() \ static constexpr size_t _qt_property_##name##_offset() \
{ \ { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name = \ QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr> name = \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>( \ QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, nullptr>( \
@ -1157,7 +1163,9 @@ private:
#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal) \ #define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal) \
static constexpr size_t _qt_property_##name##_offset() \ static constexpr size_t _qt_property_##name##_offset() \
{ \ { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name = \ QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal> name = \
QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>( \ QObjectBindableProperty<Class, Type, Class::_qt_property_##name##_offset, Signal>( \

View File

@ -586,13 +586,17 @@ private:
#define QT_OBJECT_COMPAT_PROPERTY_4(Class, Type, name, setter) \ #define QT_OBJECT_COMPAT_PROPERTY_4(Class, Type, name, setter) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter> name; QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter> name;
#define QT_OBJECT_COMPAT_PROPERTY_5(Class, Type, name, setter, signal) \ #define QT_OBJECT_COMPAT_PROPERTY_5(Class, Type, name, setter, signal) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, signal> name; QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, signal> name;
@ -603,7 +607,9 @@ private:
#define QT_OBJECT_COMPAT_PROPERTY_WITH_ARGS_5(Class, Type, name, setter, value) \ #define QT_OBJECT_COMPAT_PROPERTY_WITH_ARGS_5(Class, Type, name, setter, value) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter> name = \ QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter> name = \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter>( \ QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter>( \
@ -611,7 +617,9 @@ private:
#define QT_OBJECT_COMPAT_PROPERTY_WITH_ARGS_6(Class, Type, name, setter, signal, value) \ #define QT_OBJECT_COMPAT_PROPERTY_WITH_ARGS_6(Class, Type, name, setter, signal, value) \
static constexpr size_t _qt_property_##name##_offset() { \ static constexpr size_t _qt_property_##name##_offset() { \
QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
return offsetof(Class, name); \ return offsetof(Class, name); \
QT_WARNING_POP \
} \ } \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, signal> name = \ QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, signal> name = \
QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, \ QObjectCompatProperty<Class, Type, Class::_qt_property_##name##_offset, setter, \