[virglrenderer-devel] [PATCH 13/21] vrend_shader.c: Annotate switch/case fallthrough
Gert Wollny
gert.wollny at collabora.com
Fri Jun 1 08:48:00 UTC 2018
Silences warnings:
vrend_shader.c: In function ‘iter_declaration’:
vrend_shader.c:469:20: warning: this statement may fall through [-
Wimplicit-fallthrough=]
} else if (iter->processor.Processor ==
TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:476:7: note: here
case TGSI_SEMANTIC_VIEWPORT_INDEX:
^~~~
vrend_shader.c:477:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:487:7: note: here
case TGSI_SEMANTIC_LAYER:
^~~~
vrend_shader.c:488:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:497:7: note: here
case TGSI_SEMANTIC_PSIZE:
^~~~
vrend_shader.c:498:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
^
vrend_shader.c:506:7: note: here
case TGSI_SEMANTIC_CLIPDIST:
^~~~
vrend_shader.c:514:20: warning: this statement may fall through [-
Wimplicit-fallthrough=]
} else if (iter->processor.Processor ==
TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:521:7: note: here
case TGSI_SEMANTIC_POSITION:
^~~~
vrend_shader.c:528:20: warning: this statement may fall through [-
Wimplicit-fallthrough=]
} else if (iter->processor.Processor ==
TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:535:7: note: here
case TGSI_SEMANTIC_FACE:
^~~~
vrend_shader.c:536:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:547:7: note: here
case TGSI_SEMANTIC_GENERIC:
^~~~
vrend_shader.c:548:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
^
vrend_shader.c:559:7: note: here
default:
^~~~~~~
vrend_shader.c:670:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
^
vrend_shader.c:682:7: note: here
case TGSI_SEMANTIC_BCOLOR:
^~~~
vrend_shader.c:683:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
^
vrend_shader.c:695:7: note: here
case TGSI_SEMANTIC_PSIZE:
^~~~
vrend_shader.c:702:20: warning: this statement may fall through [-
Wimplicit-fallthrough=]
} else if (iter->processor.Processor ==
TGSI_PROCESSOR_GEOMETRY) {
^
vrend_shader.c:709:7: note: here
case TGSI_SEMANTIC_LAYER:
^~~~
vrend_shader.c:710:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
^
vrend_shader.c:718:7: note: here
case TGSI_SEMANTIC_PRIMID:
^~~~
vrend_shader.c:719:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
^
vrend_shader.c:727:7: note: here
case TGSI_SEMANTIC_VIEWPORT_INDEX:
^~~~
vrend_shader.c:728:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
^
vrend_shader.c:738:7: note: here
case TGSI_SEMANTIC_GENERIC:
^~~~
vrend_shader.c:739:13: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX)
^
vrend_shader.c:742:7: note: here
default:
^~~~~~~
vrend_shader.c: In function ‘translate_tex’:
vrend_shader.c:1339:15: warning: this statement may fall through [-
Wimplicit-fallthrough=]
is_shad = true;
^
vrend_shader.c:1340:4: note: here
case TGSI_TEXTURE_CUBE_ARRAY:
^~~~
vrend_shader.c:1351:15: warning: this statement may fall through [-
Wimplicit-fallthrough=]
is_shad = true;
^
vrend_shader.c:1352:4: note: here
case TGSI_TEXTURE_RECT:
^~~~
vrend_shader.c: In function ‘get_interp_string’:
vrend_shader.c:2789:10: warning: this statement may fall through [-
Wimplicit-fallthrough=]
if (flatshade)
^
vrend_shader.c:2791:4: note: here
default:
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/vrend_shader.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index e78a48f..329e003 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -473,6 +473,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
require_glsl_ver(ctx, 150);
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_VIEWPORT_INDEX:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
ctx->inputs[i].glsl_predefined_no_emit = true;
@@ -484,6 +485,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_LAYER;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_LAYER:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
name_prefix = "gl_Layer";
@@ -494,6 +496,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_LAYER;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_PSIZE:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_PointSize";
@@ -503,6 +506,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->inputs[i].glsl_gl_in = true;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_CLIPDIST:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_ClipDistance";
@@ -518,6 +522,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->num_in_clip_dist += 4;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_POSITION:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_Position";
@@ -531,7 +536,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->inputs[i].glsl_no_index = true;
break;
}
- /* fallthrough for vertex shader */
+ /* fallthrough */ /* for vertex shader */
case TGSI_SEMANTIC_FACE:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
if (ctx->front_face_emitted) {
@@ -544,6 +549,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->front_face_emitted = true;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_GENERIC:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
if (ctx->key->coord_replace & (1 << ctx->inputs[i].sid)) {
@@ -556,6 +562,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break;
}
}
+ /* fallthrough */
default:
switch (iter->processor.Processor) {
case TGSI_PROCESSOR_FRAGMENT:
@@ -678,7 +685,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "ex";
break;
}
-
+ /* fallthrough */
case TGSI_SEMANTIC_BCOLOR:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
if (ctx->glsl_ver_required < 140) {
@@ -692,6 +699,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "ex";
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_PSIZE:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
ctx->outputs[i].glsl_predefined_no_emit = true;
@@ -706,6 +714,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_PointSize";
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_LAYER:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true;
@@ -715,6 +724,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_Layer";
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_PRIMID:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true;
@@ -724,6 +734,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_PrimitiveID";
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_VIEWPORT_INDEX:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true;
@@ -735,10 +746,12 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX;
break;
}
+ /* fallthrough */
case TGSI_SEMANTIC_GENERIC:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX)
if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC)
color_offset = -1;
+ /* fallthrough */
default:
switch (iter->processor.Processor) {
case TGSI_PROCESSOR_FRAGMENT:
@@ -1337,6 +1350,7 @@ static int translate_tex(struct dump_ctx *ctx,
break;
case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
is_shad = true;
+ /* fallthrough */
case TGSI_TEXTURE_CUBE_ARRAY:
ctx->shader_req_bits |= SHADER_REQ_CUBE_ARRAY;
break;
@@ -1349,6 +1363,7 @@ static int translate_tex(struct dump_ctx *ctx,
break;
case TGSI_TEXTURE_SHADOWRECT:
is_shad = true;
+ /* fallthrough */
case TGSI_TEXTURE_RECT:
ctx->shader_req_bits |= SHADER_REQ_SAMPLER_RECT;
break;
@@ -2788,6 +2803,7 @@ static const char *get_interp_string(struct vrend_shader_cfg *cfg, int interpola
case TGSI_INTERPOLATE_COLOR:
if (flatshade)
return "flat ";
+ /* fallthrough */
default:
return NULL;
}
--
2.17.0
More information about the virglrenderer-devel
mailing list