diff --git a/Test/baseResults/switch.frag.out b/Test/baseResults/switch.frag.out index 65650dd36f0a713c33f1341afe459a5945a9c9cc..1a229762fb4c3d5b03a7334dcc30dee3874f7759 100644 --- a/Test/baseResults/switch.frag.out +++ b/Test/baseResults/switch.frag.out @@ -29,7 +29,14 @@ ERROR: node is still EOpNull! 0:11 'f' (highp float) 0:14 'a' (2-element array of mediump int) 0:17 'c' (uniform mediump int) -0:21 'c' (uniform mediump int) +0:21 switch +0:21 condition +0:21 'c' (uniform mediump int) +0:21 body +0:21 Sequence +0:23 case: with expression +0:23 Constant: +0:23 2 (const int) 0:26 switch 0:26 condition 0:26 'c' (uniform mediump int) @@ -286,8 +293,13 @@ ERROR: node is still EOpNull! 0:124 Constant: 0:124 0 (const int) 0:126 'onlyInSwitch' (float) -0:128 Constant: -0:128 0 (const int) +0:128 switch +0:128 condition +0:128 Constant: +0:128 0 (const int) +0:128 body +0:128 Sequence +0:129 default: 0:133 switch 0:133 condition 0:133 'c' (uniform mediump int) @@ -348,7 +360,14 @@ ERROR: node is still EOpNull! 0:11 'f' (highp float) 0:14 'a' (2-element array of mediump int) 0:17 'c' (uniform mediump int) -0:21 'c' (uniform mediump int) +0:21 switch +0:21 condition +0:21 'c' (uniform mediump int) +0:21 body +0:21 Sequence +0:23 case: with expression +0:23 Constant: +0:23 2 (const int) 0:26 switch 0:26 condition 0:26 'c' (uniform mediump int) @@ -605,8 +624,13 @@ ERROR: node is still EOpNull! 0:124 Constant: 0:124 0 (const int) 0:126 'onlyInSwitch' (float) -0:128 Constant: -0:128 0 (const int) +0:128 switch +0:128 condition +0:128 Constant: +0:128 0 (const int) +0:128 body +0:128 Sequence +0:129 default: 0:133 switch 0:133 condition 0:133 'c' (uniform mediump int) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 176d295c5b65697ac8c2c8b010b412d7880d405a..5eb151c662ab0066fd7f434720469014efab2a4a 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -5037,12 +5037,9 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, if (switchSequence->size() == 0) return expression; - if (lastStatements == 0) { + if (lastStatements == 0) warn(loc, "last case/default label not followed by statements", "switch", ""); - return expression; - } - TIntermAggregate* body = new TIntermAggregate(EOpSequence); body->getSequence() = *switchSequenceStack.back(); body->setLoc(loc);