diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2013-07-22 13:01:59 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-22 07:11:33 +0200 |
commit | c20b3587038c8834e439057c791684c5f636cd07 (patch) | |
tree | 6a048d155c1ac5f017a4020b79e6f39927c12da8 /tests/auto/tools | |
parent | 95e880bd9dd0244983acebb1d7c3bce620e93c26 (diff) |
moc: Issue a warning instead of an error when macro argument mismatch
moc's C++ is not 100% accurate, so better process the invalid macro with
a warning rather than an error.
Such errors occurred in the QSKIP macro with variadic arguments since
that macro is defined conditionally.
It is also causing problem in boost header (cf task QTBUG-29331)
Task-number: QTBUG-29331
Change-Id: Ice6a01b675286540d6470c8e36920b7efd39b540
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 3459bede85..612ce3cd7e 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1718,6 +1718,14 @@ void tst_Moc::warnings_data() << 1 << QString() << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + + QTest::newRow("Warning on invalid macro") + << QByteArray("#define Foo(a, b)\n class X : public QObject { Q_OBJECT }; \n Foo(a) \n Foo(a,b,c) \n") + << QStringList() + << 0 + << QString("IGNORE_ALL_STDOUT") + << QString(":3: Warning: Macro argument mismatch.\n:4: Warning: Macro argument mismatch."); + } void tst_Moc::warnings() @@ -1759,7 +1767,7 @@ void tst_Moc::warnings() // magic value "IGNORE_ALL_STDOUT" ignores stdout if (expectedStdOut != "IGNORE_ALL_STDOUT") QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut); - QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed(), expectedStdErr); + QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed().remove('\r'), expectedStdErr); } class tst_Moc::PrivateClass : public QObject { |