diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2012-04-10 13:38:41 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-16 00:54:19 +0200 |
commit | d2090e19a93fca9b5015d3a6978d7079e1414e13 (patch) | |
tree | 38ff69ddd6072abec5e8a87c0b7c54c00f5e7f0c | |
parent | 83fc52e3b4005d946c731577f8f49becae948c39 (diff) |
moc: Fix parsing of the empty preprocessor command
When encountering a null preprocessing directive (which is supposed to
be ignored), the moc preprocessor will leave a PP_NEWLINE token in the
token stream. That will confuse the parser.
The PP_NEWLINE token need to be ignored in the preprocessing phase.
Task-number: QTBUG-22717
Change-Id: I1e502a7e5bc6fa8ce2f82109ba7199b95747ff0a
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 07986a71e6..091f62b379 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -915,6 +915,8 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) case PP_ENDIF: until(PP_NEWLINE); continue; + case PP_NEWLINE: + continue; case SIGNALS: case SLOTS: { Symbol sym = symbol(); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 49095048bf..ecd9dc599e 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -368,6 +368,13 @@ signals: void signalInIf3(); #endif +# //QTBUG-22717 + # /* */ +# + + # \ + +// public slots: void const slotWithSillyConst() {} |