Silence moc warnings about 'argument mismatch'
The moc preprocessor is not necessarily fully compatible with the native compiler preprocessor, which can lead to annoying warnings. This fixes a problem particularly with the boost headers that rely on MSVC only preprocessor features (to work around other MSVC preprocessor deficiencies). Task-number: QTBUG-29331 Change-Id: If884452969b512a746c81e235d31636b39c45b27 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
ee31bc59be
commit
568c26227d
@ -632,12 +632,6 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
|
|||||||
if (macro.isVariadic && arguments.size() == macro.arguments.size() - 1)
|
if (macro.isVariadic && arguments.size() == macro.arguments.size() - 1)
|
||||||
arguments += Symbols();
|
arguments += Symbols();
|
||||||
|
|
||||||
if (arguments.size() != macro.arguments.size() &&
|
|
||||||
// 0 argument macros are a bit special. They are ok if the
|
|
||||||
// argument is pure whitespace or empty
|
|
||||||
(macro.arguments.size() != 0 || arguments.size() != 1 || !arguments.at(0).isEmpty()))
|
|
||||||
that->warning("Macro argument mismatch.");
|
|
||||||
|
|
||||||
// now replace the macro arguments with the expanded arguments
|
// now replace the macro arguments with the expanded arguments
|
||||||
enum Mode {
|
enum Mode {
|
||||||
Normal,
|
Normal,
|
||||||
|
@ -1837,7 +1837,7 @@ void tst_Moc::warnings_data()
|
|||||||
<< QStringList()
|
<< QStringList()
|
||||||
<< 0
|
<< 0
|
||||||
<< QString("IGNORE_ALL_STDOUT")
|
<< QString("IGNORE_ALL_STDOUT")
|
||||||
<< QString(":3: Warning: Macro argument mismatch.\n:4: Warning: Macro argument mismatch.");
|
<< QString();
|
||||||
|
|
||||||
QTest::newRow("Class declaration lacks Q_OBJECT macro.")
|
QTest::newRow("Class declaration lacks Q_OBJECT macro.")
|
||||||
<< QByteArray("class X : public QObject \n { \n public slots: \n void foo() {} \n };")
|
<< QByteArray("class X : public QObject \n { \n public slots: \n void foo() {} \n };")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user