Change ERROR to WARNING to finish fixing bug 11904, comment 3: bug 11856 resolved to drop the ERROR regarding no statements after the last label in the switch.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26479 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-05-01 16:48:18 +00:00
parent 8d6ce1c227
commit 2ea882fdae
3 changed files with 58 additions and 52 deletions

View File

@ -1,7 +1,7 @@
switch.frag switch.frag
ERROR: 0:11: 'switch' : condition must be a scalar integer expression ERROR: 0:11: 'switch' : condition must be a scalar integer expression
ERROR: 0:14: 'switch' : condition must be a scalar integer expression ERROR: 0:14: 'switch' : condition must be a scalar integer expression
ERROR: 0:21: 'switch' : last case/default label must be followed by statements WARNING: 0:21: 'switch' : last case/default label not be followed by statements
ERROR: 0:28: 'switch' : cannot have statements before first case/default label ERROR: 0:28: 'switch' : cannot have statements before first case/default label
ERROR: 0:43: 'default' : duplicate label ERROR: 0:43: 'default' : duplicate label
ERROR: 0:63: 'case' : duplicated value ERROR: 0:63: 'case' : duplicated value
@ -15,9 +15,10 @@ ERROR: 0:115: 'default' : cannot be nested inside control flow
ERROR: 0:119: 'case' : cannot appear outside switch statement ERROR: 0:119: 'case' : cannot appear outside switch statement
ERROR: 0:120: 'default' : cannot appear outside switch statement ERROR: 0:120: 'default' : cannot appear outside switch statement
ERROR: 0:126: 'onlyInSwitch' : undeclared identifier ERROR: 0:126: 'onlyInSwitch' : undeclared identifier
ERROR: 0:128: 'switch' : last case/default label must be followed by statements WARNING: 0:128: 'switch' : last case/default label not be followed by statements
ERROR: 0:140: 'nestedX' : undeclared identifier ERROR: 0:140: 'nestedX' : undeclared identifier
ERROR: 18 compilation errors. No code generated. ERROR: 0:156: 'nestedZ' : undeclared identifier
ERROR: 17 compilation errors. No code generated.
Shader version: 300 Shader version: 300
@ -303,32 +304,33 @@ ERROR: node is still EOpNull!
0:139 2 (const int) 0:139 2 (const int)
0:? Sequence 0:? Sequence
0:140 'nestedX' (float) 0:140 'nestedX' (float)
0:141 Branch: Break 0:143 Branch: Break
0:142 case: with expression 0:144 case: with expression
0:142 Constant: 0:144 Constant:
0:142 3 (const int) 0:144 3 (const int)
0:? Sequence 0:? Sequence
0:144 Branch: Break 0:146 Branch: Break
0:145 case: with expression 0:147 case: with expression
0:145 Constant: 0:147 Constant:
0:145 4 (const int) 0:147 4 (const int)
0:? Sequence 0:? Sequence
0:146 Sequence 0:148 Sequence
0:146 move second child to first child (mediump int) 0:148 move second child to first child (mediump int)
0:146 'linearY' (mediump int) 0:148 'linearY' (mediump int)
0:146 'linearZ' (mediump int) 0:148 'linearZ' (mediump int)
0:147 Branch: Break 0:149 Branch: Break
0:148 case: with expression 0:150 case: with expression
0:148 Constant: 0:150 Constant:
0:148 5 (const int) 0:150 5 (const int)
0:? Sequence 0:? Sequence
0:150 Branch: Break 0:152 Branch: Break
0:151 case: with expression 0:153 case: with expression
0:151 Constant: 0:153 Constant:
0:151 6 (const int) 0:153 6 (const int)
0:? Sequence 0:? Sequence
0:152 Constant: 0:154 Constant:
0:152 4 (const int) 0:154 4 (const int)
0:156 'nestedZ' (float)
0:? Linker Objects 0:? Linker Objects
0:? 'c' (uniform mediump int) 0:? 'c' (uniform mediump int)
0:? 'd' (uniform mediump int) 0:? 'd' (uniform mediump int)
@ -621,32 +623,33 @@ ERROR: node is still EOpNull!
0:139 2 (const int) 0:139 2 (const int)
0:? Sequence 0:? Sequence
0:140 'nestedX' (float) 0:140 'nestedX' (float)
0:141 Branch: Break 0:143 Branch: Break
0:142 case: with expression 0:144 case: with expression
0:142 Constant: 0:144 Constant:
0:142 3 (const int) 0:144 3 (const int)
0:? Sequence 0:? Sequence
0:144 Branch: Break 0:146 Branch: Break
0:145 case: with expression 0:147 case: with expression
0:145 Constant: 0:147 Constant:
0:145 4 (const int) 0:147 4 (const int)
0:? Sequence 0:? Sequence
0:146 Sequence 0:148 Sequence
0:146 move second child to first child (mediump int) 0:148 move second child to first child (mediump int)
0:146 'linearY' (mediump int) 0:148 'linearY' (mediump int)
0:146 'linearZ' (mediump int) 0:148 'linearZ' (mediump int)
0:147 Branch: Break 0:149 Branch: Break
0:148 case: with expression 0:150 case: with expression
0:148 Constant: 0:150 Constant:
0:148 5 (const int) 0:150 5 (const int)
0:? Sequence 0:? Sequence
0:150 Branch: Break 0:152 Branch: Break
0:151 case: with expression 0:153 case: with expression
0:151 Constant: 0:153 Constant:
0:151 6 (const int) 0:153 6 (const int)
0:? Sequence 0:? Sequence
0:152 Constant: 0:154 Constant:
0:152 4 (const int) 0:154 4 (const int)
0:156 'nestedZ' (float)
0:? Linker Objects 0:? Linker Objects
0:? 'c' (uniform mediump int) 0:? 'c' (uniform mediump int)
0:? 'd' (uniform mediump int) 0:? 'd' (uniform mediump int)

View File

@ -18,7 +18,7 @@ void main()
{ {
} }
switch(c) // ERROR, not enough stuff after last label switch(c) // WARNING, not enough stuff after last label
{ {
case 2: case 2:
} }
@ -127,7 +127,7 @@ void main()
switch (0) { switch (0) {
default: default:
int x; // current "no statement" ERROR, but maybe this should count as a statement, or the semantic check removed int x; // WARNING (was "no statement" ERROR, but spec. changed because unclear what a statement is)
} }
switch (c) { switch (c) {
@ -138,6 +138,8 @@ void main()
} }
case 2: case 2:
nestedX; // ERROR nestedX; // ERROR
int nestedZ;
float a; // okay, hiding outer 'a'
break; break;
case 3: case 3:
int linearZ; int linearZ;
@ -145,10 +147,11 @@ void main()
case 4: case 4:
int linearY = linearZ; int linearY = linearZ;
break; break;
case 5: // ERROR? that branch bypassed an initializer? case 5: // okay that branch bypassed an initializer
const int linearC = 4; const int linearC = 4;
break; break;
case 6: // ERROR? that branch bypassed an initializer? case 6: // okay that branch bypassed an initializer
linearC; linearC;
} }
nestedZ; // ERROR, no longer in scope
} }

View File

@ -4578,7 +4578,7 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression,
return expression; return expression;
if (lastStatements == 0) { if (lastStatements == 0) {
error(loc, "last case/default label must be followed by statements", "switch", ""); warn(loc, "last case/default label not be followed by statements", "switch", "");
return expression; return expression;
} }