Fix corner case in preprocessor of QOpenGLShaderProgram

The preprocessor used in QOpenGLShaderProgram to help with determining
where it should add the #line and other #define directives is broken
when parsing the standard Qt Project copyright header.

In a multiline comment if the preprocessor encounters repeated '*'
characters when in a multiline comment, it toggles the state between
MultiLineComment and CommentEnding. This is wrong as every asterisk is
potentially the one before the closing '/' of a multiline comment.

This change fixes this by only going back to the MultiLineComment when
in the CommentEnding state if the character is not another '*'.

Task-number: QTBUG-43240
Change-Id: I114e933026ba5de1c23f3e0399613def59f44961
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
This commit is contained in:
Sean Harmer 2014-12-11 19:51:38 +00:00
parent ec9104a71d
commit c514572f09

View File

@ -471,7 +471,8 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source
} else {
if (*c == QLatin1Char('#'))
*c = QLatin1Char('_');
state = MultiLineComment;
if (*c != QLatin1Char('*'))
state = MultiLineComment;
}
break;
}