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.

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9cdceec33017d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Thiago Macieira 2022-06-21 10:40:20 -07:00
parent dda9c9e2bc
commit 9959cf60d3

View File

@ -254,7 +254,7 @@ void Generator::generateCode()
// Macro that simplifies the string data listing. The offset is calculated
// from the top of the stringdata object (i.e., past the uints).
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",