To be compatible with Feature: 'last case/default label not followed by statements'.
authorZhiqianXia <xzq0528@outlook.com>
Thu, 29 Jul 2021 02:01:40 +0000 (10:01 +0800)
committerZhiqianXia <xzq0528@outlook.com>
Thu, 28 Oct 2021 01:23:19 +0000 (09:23 +0800)
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
glslang/MachineIndependent/ParseHelper.cpp

index c2b9edc..a7a9de2 100644 (file)
@@ -9188,11 +9188,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."
         // 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.
-        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", "");
         else
             warn(loc, "last case/default label not followed by statements", "switch", "");
 
+
         // emulate a break for error recovery
         lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc));
         lastStatements->setOperator(EOpSequence);