summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-01-14 13:38:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-15 08:18:11 +0100
commit40133df06fea67ab3983b90844cc2a8f47e6e20c (patch)
treee195a33ccb6412fb87282f79cdff847f12d3e3a0
parent1cf5cd34f70bd04dd9d1850b2fdd4a99d7ba5919 (diff)
moc: Fix -Wsign-conversion warning in the moc generated file
There is the warning it fixes: moc_foo.cpp:28:9: warning: conversion to ‘qptrdiff {aka long long int}’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion] - idx * sizeof(QByteArrayData) \ ^ qarraydata.h:282:49: note: in definition of macro ‘Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ { Q_REFCOUNT_INITIALIZE_STATIC, size, 0, 0, offset } \ ^ moc_foo.cpp:26:5: note: in expansion of macro ‘Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET’ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ ^ moc_foo.cpp:33:1: note: in expansion of macro ‘QT_MOC_LITERAL’ QT_MOC_LITERAL(1, 23, 5), ^ [ChangeLog][moc][QTBUG-36128] Fixed sign conversion warning in generated file. Task-number: QTBUG-36128 Change-Id: Ibf00974dbfb419bb53a3109d93e4cee598bb0588 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/tools/moc/generator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 8c1a2f0354..3546d2e395 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -255,8 +255,8 @@ void Generator::generateCode()
// QByteArrayData::data() implementation returning simply "this + offset".
fprintf(out, "#define QT_MOC_LITERAL(idx, ofs, len) \\\n"
" Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\\n"
- " offsetof(qt_meta_stringdata_%s_t, stringdata) + ofs \\\n"
- " - idx * sizeof(QByteArrayData) \\\n"
+ " qptrdiff(offsetof(qt_meta_stringdata_%s_t, stringdata) + ofs \\\n"
+ " - idx * sizeof(QByteArrayData)) \\\n"
" )\n",
qualifiedClassNameIdentifier.constData());