Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
0e7674af
Commit
0e7674af
authored
Jun 26, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the "switch-label not followed by statement" warning an error, depending on version.
parent
add1a4d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
+16
-7
spv.switch.frag.out
Test/baseResults/spv.switch.frag.out
+2
-1
switch.frag.out
Test/baseResults/switch.frag.out
+3
-3
spv.switch.frag
Test/spv.switch.frag
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+10
-2
No files found.
Test/baseResults/spv.switch.frag.out
View file @
0e7674af
spv.switch.frag
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
WARNING: 0:121: 'switch' : last case/default label not followed by statements
WARNING: 0:134: 'switch' : last case/default label not followed by statements
WARNING: 0:139: 'switch' : last case/default label not followed by statements
...
...
@@ -11,7 +12,7 @@ Linked fragment stage:
// Generated by (magic number): 51a00bb
// Id's are bound by 261
Source ESSL 3
0
0
Source ESSL 3
1
0
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4
...
...
Test/baseResults/switch.frag.out
View file @
0e7674af
switch.frag
ERROR: 0:11: 'switch' : condition must be a scalar integer expression
ERROR: 0:14: 'switch' : condition must be a scalar integer expression
WARNING
: 0:21: 'switch' : last case/default label not followed by statements
ERROR
: 0:21: 'switch' : last case/default label not followed by statements
ERROR: 0:28: 'switch' : cannot have statements before first case/default label
ERROR: 0:43: 'default' : duplicate label
ERROR: 0:63: 'case' : duplicated value
...
...
@@ -15,10 +15,10 @@ ERROR: 0:115: 'default' : cannot be nested inside control flow
ERROR: 0:119: 'case' : cannot appear outside switch statement
ERROR: 0:120: 'default' : cannot appear outside switch statement
ERROR: 0:126: 'onlyInSwitch' : undeclared identifier
WARNING
: 0:128: 'switch' : last case/default label not followed by statements
ERROR
: 0:128: 'switch' : last case/default label not followed by statements
ERROR: 0:140: 'nestedX' : undeclared identifier
ERROR: 0:157: 'nestedZ' : undeclared identifier
ERROR: 1
7
compilation errors. No code generated.
ERROR: 1
9
compilation errors. No code generated.
Shader version: 300
...
...
Test/spv.switch.frag
View file @
0e7674af
#version 3
0
0 es
#version 3
1
0 es
precision
mediump
float
;
uniform
int
c
,
d
;
in
float
x
;
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
0e7674af
...
...
@@ -5186,8 +5186,16 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression,
if
(
switchSequence
->
size
()
==
0
)
return
expression
;
if
(
lastStatements
==
0
)
warn
(
loc
,
"last case/default label not followed by statements"
,
"switch"
,
""
);
if
(
lastStatements
==
0
)
{
// This was originally an ERRROR, because early versions of the specification said
// "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
(
profile
==
EEsProfile
&&
version
<=
300
&&
(
messages
&
EShMsgRelaxedErrors
)
==
0
)
error
(
loc
,
"last case/default label not followed by statements"
,
"switch"
,
""
);
else
warn
(
loc
,
"last case/default label not followed by statements"
,
"switch"
,
""
);
}
TIntermAggregate
*
body
=
new
TIntermAggregate
(
EOpSequence
);
body
->
getSequence
()
=
*
switchSequenceStack
.
back
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment