Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12
-
None
Description
moc adds an extra semicolon to Q_UNUSED.
moc this code:
class MyQObject : public QObject { Q_OBJECT };
current moc output:
...
void MyQObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
...
expected moc output:
...
void MyQObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o)
Q_UNUSED(_id)
Q_UNUSED(_c)
Q_UNUSED(_a)
}
...
Q_UNUSED expands to #define Q_UNUSED( x ) (void)x;, so the semicolon added by moc is superfluous.
This triggers a compiler warning: -Wextra-semi-stmt