From 9959cf60d360a43c87c77f44a7d17e2fae25a303 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jun 2022 10:40:20 -0700 Subject: 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 --- src/tools/moc/generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools/moc') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index b0a3ff37a4..b80e013ba4 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -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", -- cgit v1.2.3