CPP: Fix stack of previous nested #if/#else/#endif for whether a #else had been seen, which was sometimes cleared and sometimes not, effected later nested #if/#else/#endif #else checks.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20573 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
aab251435b
commit
e25cd0447d
@ -323,16 +323,15 @@ static int CPPelse(int matchelse, yystypepp * yylvalpp)
|
||||
cpp->ifdepth++;
|
||||
cpp->elsetracker++;
|
||||
} else if (atom == endifAtom) {
|
||||
if (depth == 0) {
|
||||
// found the #endif we are looking for
|
||||
cpp->elsedepth[cpp->elsetracker] = 0;
|
||||
--cpp->elsetracker;
|
||||
if (depth == 0) {
|
||||
// found the #endif we are looking for
|
||||
if (cpp->ifdepth)
|
||||
--cpp->ifdepth;
|
||||
break;
|
||||
}
|
||||
--depth;
|
||||
--cpp->elsetracker;
|
||||
--cpp->ifdepth;
|
||||
} else if (matchelse && depth == 0) {
|
||||
if (atom == elseAtom ) {
|
||||
@ -349,6 +348,7 @@ static int CPPelse(int matchelse, yystypepp * yylvalpp)
|
||||
* it and we really want to leave it alone */
|
||||
if (cpp->ifdepth) {
|
||||
--cpp->ifdepth;
|
||||
cpp->elsedepth[cpp->elsetracker] = 0;
|
||||
--cpp->elsetracker;
|
||||
}
|
||||
|
||||
@ -499,7 +499,8 @@ error:
|
||||
return token;
|
||||
} // eval
|
||||
|
||||
static int CPPif(yystypepp * yylvalpp) {
|
||||
static int CPPif(yystypepp * yylvalpp)
|
||||
{
|
||||
int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
||||
int res = 0, err = 0;
|
||||
cpp->elsetracker++;
|
||||
@ -1057,9 +1058,9 @@ int ChkCorrectElseNesting(void)
|
||||
{
|
||||
if (cpp->elsedepth[cpp->elsetracker] == 0) {
|
||||
cpp->elsedepth[cpp->elsetracker] = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user