Properly handle 'default' nested in flow control, as well as default/case outside switch statements.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24629 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
ddbe0befd7
commit
99b0ffd468
Binary file not shown.
@ -109,8 +109,13 @@ void main()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case 4:
|
||||||
f = tan(x);
|
f = tan(x);
|
||||||
|
if (f < 0.0)
|
||||||
|
default: // ERROR
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 5: // ERROR
|
||||||
|
default: // ERROR
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
// source have to figure out how to create revision.h just to get a build
|
// source have to figure out how to create revision.h just to get a build
|
||||||
// going. However, if it is not updated, it can be a version behind.
|
// going. However, if it is not updated, it can be a version behind.
|
||||||
|
|
||||||
#define GLSLANG_REVISION "24627"
|
#define GLSLANG_REVISION "24628"
|
||||||
#define GLSLANG_DATE "2013/12/30 13:40:03"
|
#define GLSLANG_DATE "2013/12/30 13:44:49"
|
||||||
|
@ -2276,15 +2276,24 @@ switch_statement_list
|
|||||||
|
|
||||||
case_label
|
case_label
|
||||||
: CASE expression COLON {
|
: CASE expression COLON {
|
||||||
|
$$ = 0;
|
||||||
if (parseContext.switchLevel.size() == 0)
|
if (parseContext.switchLevel.size() == 0)
|
||||||
parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
|
parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
|
||||||
else if (parseContext.switchLevel.back() != parseContext.controlFlowNestingLevel)
|
else if (parseContext.switchLevel.back() != parseContext.controlFlowNestingLevel)
|
||||||
parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
|
parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
|
||||||
|
else {
|
||||||
parseContext.constantValueCheck($2, "case");
|
parseContext.constantValueCheck($2, "case");
|
||||||
parseContext.integerCheck($2, "case");
|
parseContext.integerCheck($2, "case");
|
||||||
$$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
|
$$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
| DEFAULT COLON {
|
| DEFAULT COLON {
|
||||||
|
$$ = 0;
|
||||||
|
if (parseContext.switchLevel.size() == 0)
|
||||||
|
parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
|
||||||
|
else if (parseContext.switchLevel.back() != parseContext.controlFlowNestingLevel)
|
||||||
|
parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
|
||||||
|
else
|
||||||
$$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
|
$$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user