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->ifdepth++;
|
||||||
cpp->elsetracker++;
|
cpp->elsetracker++;
|
||||||
} else if (atom == endifAtom) {
|
} else if (atom == endifAtom) {
|
||||||
if (depth == 0) {
|
|
||||||
// found the #endif we are looking for
|
|
||||||
cpp->elsedepth[cpp->elsetracker] = 0;
|
cpp->elsedepth[cpp->elsetracker] = 0;
|
||||||
--cpp->elsetracker;
|
--cpp->elsetracker;
|
||||||
|
if (depth == 0) {
|
||||||
|
// found the #endif we are looking for
|
||||||
if (cpp->ifdepth)
|
if (cpp->ifdepth)
|
||||||
--cpp->ifdepth;
|
--cpp->ifdepth;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
--depth;
|
--depth;
|
||||||
--cpp->elsetracker;
|
|
||||||
--cpp->ifdepth;
|
--cpp->ifdepth;
|
||||||
} else if (matchelse && depth == 0) {
|
} else if (matchelse && depth == 0) {
|
||||||
if (atom == elseAtom ) {
|
if (atom == elseAtom ) {
|
||||||
@ -349,6 +348,7 @@ static int CPPelse(int matchelse, yystypepp * yylvalpp)
|
|||||||
* it and we really want to leave it alone */
|
* it and we really want to leave it alone */
|
||||||
if (cpp->ifdepth) {
|
if (cpp->ifdepth) {
|
||||||
--cpp->ifdepth;
|
--cpp->ifdepth;
|
||||||
|
cpp->elsedepth[cpp->elsetracker] = 0;
|
||||||
--cpp->elsetracker;
|
--cpp->elsetracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +499,8 @@ error:
|
|||||||
return token;
|
return token;
|
||||||
} // eval
|
} // eval
|
||||||
|
|
||||||
static int CPPif(yystypepp * yylvalpp) {
|
static int CPPif(yystypepp * yylvalpp)
|
||||||
|
{
|
||||||
int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
||||||
int res = 0, err = 0;
|
int res = 0, err = 0;
|
||||||
cpp->elsetracker++;
|
cpp->elsetracker++;
|
||||||
@ -1057,9 +1058,9 @@ int ChkCorrectElseNesting(void)
|
|||||||
{
|
{
|
||||||
if (cpp->elsedepth[cpp->elsetracker] == 0) {
|
if (cpp->elsedepth[cpp->elsetracker] == 0) {
|
||||||
cpp->elsedepth[cpp->elsetracker] = 1;
|
cpp->elsedepth[cpp->elsetracker] = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user