[virglrenderer-devel] [PATCH v2 13/21] vrend_shader.c: Fix warnings
Gert Wollny
gert.wollny at collabora.com
Tue Jun 5 20:11:10 UTC 2018
vrend_shader.c: In function »iter_declaration«:
vrend_shader.c:341:27: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
^
vrend_shader.c:372:39: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
^
vrend_shader.c:389:42: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
^
vrend_shader.c:549:28: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_outputs > ARRAY_SIZE(ctx->outputs)) {
^
vrend_shader.c:755:27: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_ubo >= ARRAY_SIZE(ctx->ubo_idx)) {
^~
vrend_shader.c:775:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->num_system_values > ARRAY_SIZE(ctx->system_values)) {
^
vrend_shader.c: In function »iter_immediate«:
vrend_shader.c:875:14: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (first >= ARRAY_SIZE(ctx->imm)) {
^~
vrend_shader.c: In function »prepare_so_movs«:
vrend_shader.c:1030:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < ctx->so->num_outputs; i++) {
^
vrend_shader.c: In function »emit_so_movs«:
vrend_shader.c:1063:18: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < ctx->so->num_outputs; i++) {
^
vrend_shader.c: In function »translate_tex«:
vrend_shader.c:1253:19: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (sreg_index >= ARRAY_SIZE(ctx->samplers)) {
^~
vrend_shader.c:1567:37: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (inst->TexOffsets[0].Index >= ARRAY_SIZE(ctx->imm)) {
^~
vrend_shader.c: In function »iter_instruction«:
vrend_shader.c:1814:39: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->outputs[j].first == dst->Register.Index) {
^~
vrend_shader.c:1903:38: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->inputs[j].first == src->Register.Index) {
^~
vrend_shader.c:2014:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (src->Register.Index >= ARRAY_SIZE(ctx->imm)) {
^~
vrend_shader.c:2094:45: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
if (ctx->system_values[j].first == src->Register.Index) {
^~
vrend_shader.c: In function »get_aux_string«:
vrend_shader.c:2712:60: Warnung: unused parameter »cfg« [-Wunused-
parameter]
static const char *get_aux_string(struct vrend_shader_cfg *cfg, bool
centroid)
^~~
vrend_shader.c: Auf höchster Ebene:
vrend_shader.c:2717:19: Warnung: Typkennzeichner an Funktions-
Rückgabewert ignoriert [-Wignored-qualifiers]
static const char get_return_type_prefix(enum tgsi_return_type type)
^~~~~~~~~~~~~~~~~~~~~~
vrend_shader.c: In function »emit_ios«:
vrend_shader.c:2935:21: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (i = 0; i < ctx->so->num_outputs; i++) {
v2: - Use mesa style UNUSED annotation for unused parameters
- Correct language of warning messages
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/vrend_shader.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 9ca015a..2881041 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -62,7 +62,7 @@ struct vrend_shader_io {
unsigned done;
int sid;
unsigned interpolate;
- unsigned first;
+ int first;
bool centroid;
bool invariant;
bool glsl_predefined_no_emit;
@@ -430,7 +430,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
switch (decl->Declaration.File) {
case TGSI_FILE_INPUT:
i = ctx->num_inputs++;
- if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
+ if ((uint)ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return FALSE;
}
@@ -461,7 +461,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
} else {
if (ctx->key->color_two_side) {
int j = ctx->num_inputs++;
- if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
+ if ((uint)ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return FALSE;
}
@@ -478,7 +478,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
if (ctx->front_face_emitted == false) {
int k = ctx->num_inputs++;
- if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
+ if ((uint)ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return FALSE;
}
@@ -624,7 +624,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break;
case TGSI_FILE_OUTPUT:
i = ctx->num_outputs++;
- if (ctx->num_outputs > ARRAY_SIZE(ctx->outputs)) {
+ if ((uint)ctx->num_outputs > ARRAY_SIZE(ctx->outputs)) {
fprintf(stderr, "Number of outputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->outputs));
return FALSE;
}
@@ -817,7 +817,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break;
case TGSI_FILE_CONSTANT:
if (decl->Declaration.Dimension) {
- if (ctx->num_ubo >= ARRAY_SIZE(ctx->ubo_idx)) {
+ if ((uint)ctx->num_ubo >= ARRAY_SIZE(ctx->ubo_idx)) {
fprintf(stderr, "Number of uniforms exceeded, max is %lu\n", ARRAY_SIZE(ctx->ubo_idx));
return FALSE;
}
@@ -837,7 +837,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break;
case TGSI_FILE_SYSTEM_VALUE:
i = ctx->num_system_values++;
- if (ctx->num_system_values > ARRAY_SIZE(ctx->system_values)) {
+ if ((uint)ctx->num_system_values > ARRAY_SIZE(ctx->system_values)) {
fprintf(stderr, "Number of system values exceeded, max is %lu\n", ARRAY_SIZE(ctx->system_values));
return FALSE;
}
@@ -937,7 +937,7 @@ iter_immediate(
int i;
int first = ctx->num_imm;
- if (first >= ARRAY_SIZE(ctx->imm)) {
+ if ((uint)first >= ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Number of immediates exceeded, max is: %lu\n", ARRAY_SIZE(ctx->imm));
return FALSE;
}
@@ -1091,7 +1091,7 @@ static int emit_prescale(struct dump_ctx *ctx)
static int prepare_so_movs(struct dump_ctx *ctx)
{
- int i;
+ uint i;
for (i = 0; i < ctx->so->num_outputs; i++) {
ctx->write_so_outputs[i] = true;
if (ctx->so->output[i].start_component != 0)
@@ -1115,7 +1115,7 @@ static int prepare_so_movs(struct dump_ctx *ctx)
static int emit_so_movs(struct dump_ctx *ctx)
{
char buf[255];
- int i, j;
+ uint i, j;
char outtype[15] = {0};
char writemask[6];
char *sret;
@@ -1315,7 +1315,7 @@ static int translate_tex(struct dump_ctx *ctx,
int sampler_index;
const char *tex_ext;
- if (sreg_index >= ARRAY_SIZE(ctx->samplers)) {
+ if ((uint)sreg_index >= ARRAY_SIZE(ctx->samplers)) {
fprintf(stderr, "Sampler view exceeded, max is %lu\n", ARRAY_SIZE(ctx->samplers));
return FALSE;
}
@@ -1629,7 +1629,7 @@ static int translate_tex(struct dump_ctx *ctx,
}
if (inst->Texture.NumOffsets == 1) {
- if (inst->TexOffsets[0].Index >= ARRAY_SIZE(ctx->imm)) {
+ if ((uint)inst->TexOffsets[0].Index >= ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm));
return false;
}
@@ -1830,7 +1830,7 @@ get_destination_info(struct dump_ctx *ctx,
}
if (dst_reg->Register.File == TGSI_FILE_OUTPUT) {
- for (uint32_t j = 0; j < ctx->num_outputs; j++) {
+ for (int32_t j = 0; j < ctx->num_outputs; j++) {
if (ctx->outputs[j].first == dst_reg->Register.Index) {
if (ctx->glsl_ver_required >= 140 && ctx->outputs[j].name == TGSI_SEMANTIC_CLIPVERTEX) {
snprintf(dsts[i], 255, "clipv_tmp");
@@ -1951,7 +1951,7 @@ get_source_info(struct dump_ctx *ctx,
swizzle[swz_idx++] = get_swiz_char(src->Register.SwizzleW);
}
if (src->Register.File == TGSI_FILE_INPUT) {
- for (uint32_t j = 0; j < ctx->num_inputs; j++)
+ for (int32_t j = 0; j < ctx->num_inputs; j++)
if (ctx->inputs[j].first == src->Register.Index) {
if (ctx->key->color_two_side && ctx->inputs[j].name == TGSI_SEMANTIC_COLOR)
snprintf(srcs[i], 255, "%s(%s%s%d%s%s)", get_string(stypeprefix), prefix, "realcolor", ctx->inputs[j].sid, arrayname, swizzle);
@@ -2061,7 +2061,7 @@ get_source_info(struct dump_ctx *ctx,
}
*sreg_index = src->Register.Index;
} else if (src->Register.File == TGSI_FILE_IMMEDIATE) {
- if (src->Register.Index >= ARRAY_SIZE(ctx->imm)) {
+ if ((uint)src->Register.Index >= ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm));
return false;
}
@@ -2140,7 +2140,7 @@ get_source_info(struct dump_ctx *ctx,
}
}
} else if (src->Register.File == TGSI_FILE_SYSTEM_VALUE) {
- for (uint32_t j = 0; j < ctx->num_system_values; j++)
+ for (int32_t j = 0; j < ctx->num_system_values; j++)
if (ctx->system_values[j].first == src->Register.Index) {
if (ctx->system_values[j].name == TGSI_SEMANTIC_VERTEXID ||
ctx->system_values[j].name == TGSI_SEMANTIC_INSTANCEID ||
@@ -2807,12 +2807,12 @@ static const char *get_interp_string(struct vrend_shader_cfg *cfg, int interpola
}
}
-static const char *get_aux_string(struct vrend_shader_cfg *cfg, bool centroid)
+static const char *get_aux_string(UNUSED struct vrend_shader_cfg *cfg, bool centroid)
{
return centroid ? "centroid " : "";
}
-static const char get_return_type_prefix(enum tgsi_return_type type)
+static char get_return_type_prefix(enum tgsi_return_type type)
{
if (type == TGSI_RETURN_TYPE_SINT)
return 'i';
@@ -3030,7 +3030,7 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
if (ctx->so) {
char outtype[6] = {0};
- for (i = 0; i < ctx->so->num_outputs; i++) {
+ for (i = 0; i < (int)ctx->so->num_outputs; i++) {
if (!ctx->write_so_outputs[i])
continue;
if (ctx->so->output[i].num_components == 1)
--
2.16.4
More information about the virglrenderer-devel
mailing list