moc: replace offsetof with sizeof

It's the same thing since we have exactly one field in this structure
before stringdata0. But there's a far smaller chance of producing a
warning in user code.

Change-Id: Id0fb9ab0089845ee8843fffd16f9cdceec33017d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9959cf60d360a43c87c77f44a7d17e2fae25a303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-06-21 10:40:20 -07:00 committed by Qt Cherry-pick Bot
parent ee6677dbea
commit 0f50f46efc

View File

@ -269,7 +269,7 @@ void Generator::generateCode()
// QByteArrayData being defined. This calculation relies on the
// QByteArrayData::data() implementation returning simply "this + offset".
fprintf(out, "#define QT_MOC_LITERAL(ofs, len) \\\n"
" uint(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs), len \n",
" uint(sizeof(qt_meta_stringdata_%s_t::offsetsAndSizes) + ofs), len \n",
qualifiedClassNameIdentifier.constData());
fprintf(out, "static const qt_meta_stringdata_%s_t qt_meta_stringdata_%s = {\n",