Make qdoc read multiline macros in files with CRLF endings

This caused qdoc for instance to not being able to parse qglobal.h
correctly. (On windows, it stopped to parse anything meaningful after
the line with this macro:)

  #define Q_INIT_RESOURCE_EXTERN(name) \
      extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();

It worked on linux just because on linux a line continuation 'token' is
the sequence "\\\n" (on windows it is "\\\r\n")

So for files with CRLF line endings, it treated *only* the first line
as a macro, potentially causing the subsequent lines to affect the
state of the tokenizer.

Change-Id: If7c80ee7eb317f2d324ace7ff540ced7c31185dc
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Martin Smith <martin.smith@nokia.com>
This commit is contained in:
Jan-Arve Saether 2012-09-11 13:16:27 +02:00 committed by Qt by Nokia
parent 1b569fe455
commit a95ce12b91

View File

@ -599,8 +599,11 @@ int Tokenizer::getTokenAfterPreprocessor()
}
if (!directive.isEmpty()) {
while (yyCh != EOF && yyCh != '\n') {
if (yyCh == '\\')
if (yyCh == '\\') {
yyCh = getChar();
if (yyCh == '\r')
yyCh = getChar();
}
condition += yyCh;
yyCh = getChar();
}