summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglshaderprogram.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2014-12-11 19:51:38 +0000
committerSean Harmer <sean.harmer@kdab.com>2014-12-15 08:47:37 +0100
commitc514572f0914a4c4df6d763eea0fc9901f9b7c80 (patch)
tree908e693be5776b4665e046be468ff0f655f01130 /src/gui/opengl/qopenglshaderprogram.cpp
parentec9104a71dc89f319eb09fca91ef054bdc217244 (diff)
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>
Diffstat (limited to 'src/gui/opengl/qopenglshaderprogram.cpp')
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 7d165aed48..2d99833fdf 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -471,7 +471,8 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source
} else {
if (*c == QLatin1Char('#'))
*c = QLatin1Char('_');
- state = MultiLineComment;
+ if (*c != QLatin1Char('*'))
+ state = MultiLineComment;
}
break;
}