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>
bb10
Olivier Goffart 2014-01-14 13:38:15 +01:00 committed by The Qt Project
parent 1cf5cd34f7
commit 40133df06f
1 changed files with 2 additions and 2 deletions

View File

@ -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());