Merge pull request #2712 from ZhiqianXia/switch_error
glslang should report a error for Feature: last case/default label not followed by statements'.
This commit is contained in:
commit
77d680e1c3
@ -9246,11 +9246,14 @@ TIntermNode* TParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expre
|
|||||||
// "it is an error to have no statement between a label and the end of the switch statement."
|
// "it is an error to have no statement between a label and the end of the switch statement."
|
||||||
// The specifications were updated to remove this (being ill-defined what a "statement" was),
|
// The specifications were updated to remove this (being ill-defined what a "statement" was),
|
||||||
// so, this became a warning. However, 3.0 tests still check for the error.
|
// so, this became a warning. However, 3.0 tests still check for the error.
|
||||||
if (isEsProfile() && version <= 300 && ! relaxedErrors())
|
if (isEsProfile() && (version <= 300 || version >= 320) && ! relaxedErrors())
|
||||||
|
error(loc, "last case/default label not followed by statements", "switch", "");
|
||||||
|
else if (!isEsProfile() && (version <= 430 || version >= 460))
|
||||||
error(loc, "last case/default label not followed by statements", "switch", "");
|
error(loc, "last case/default label not followed by statements", "switch", "");
|
||||||
else
|
else
|
||||||
warn(loc, "last case/default label not followed by statements", "switch", "");
|
warn(loc, "last case/default label not followed by statements", "switch", "");
|
||||||
|
|
||||||
|
|
||||||
// emulate a break for error recovery
|
// emulate a break for error recovery
|
||||||
lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc));
|
lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc));
|
||||||
lastStatements->setOperator(EOpSequence);
|
lastStatements->setOperator(EOpSequence);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user