[Mesa-dev] [PATCH 11/24] gallium/aux/tgsi_exec.c: Fix various -Wsign-compare

Gert Wollny gert.wollny at collabora.com
Tue Jun 5 11:58:54 UTC 2018


tgsi/tgsi_exec.c: In function 'exec_tex':
tgsi/tgsi_exec.c:2254:46: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
       assert(shadow_ref >= dim && shadow_ref < ARRAY_SIZE(args));
                                              ^
./util/u_debug.h:189:30: note: in definition of macro 'debug_assert'
 #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr,
__FILE__, __LINE__, __FUNCTION__))
                              ^~~~
tgsi/tgsi_exec.c:2254:7: note: in expansion of macro 'assert'
       assert(shadow_ref >= dim && shadow_ref < ARRAY_SIZE(args));
       ^~~~~~
tgsi/tgsi_exec.c:2290:23: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
       for (i = dim; i < ARRAY_SIZE(args); i++)
                       ^
In file included from ./util/u_memory.h:39:0,
                 from tgsi/tgsi_exec.c:62:
tgsi/tgsi_exec.c: In function 'exec_lodq':
tgsi/tgsi_exec.c:2357:15: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    assert(dim <= ARRAY_SIZE(coords));
               ^
./util/u_debug.h:189:30: note: in definition of macro 'debug_assert'
 #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr,
__FILE__, __LINE__, __FUNCTION__))
                              ^~~~
tgsi/tgsi_exec.c:2357:4: note: in expansion of macro 'assert'
    assert(dim <= ARRAY_SIZE(coords));
    ^~~~~~
tgsi/tgsi_exec.c:2363:20: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = dim; i < ARRAY_SIZE(coords); i++) {
                    ^

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/gallium/auxiliary/tgsi/tgsi_exec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index d9ac0ff9dd..59194ebe31 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2251,7 +2251,7 @@ exec_tex(struct tgsi_exec_machine *mach,
 
    assert(dim <= 4);
    if (shadow_ref >= 0)
-      assert(shadow_ref >= dim && shadow_ref < ARRAY_SIZE(args));
+      assert(shadow_ref >= dim && shadow_ref < (int)ARRAY_SIZE(args));
 
    /* fetch modifier to the last argument */
    if (modifier != TEX_MODIFIER_NONE) {
@@ -2287,7 +2287,7 @@ exec_tex(struct tgsi_exec_machine *mach,
          control = TGSI_SAMPLER_GATHER;
    }
    else {
-      for (i = dim; i < ARRAY_SIZE(args); i++)
+      for (i = dim; i < (int)ARRAY_SIZE(args); i++)
          args[i] = &ZeroVec;
    }
 
@@ -2339,8 +2339,8 @@ exec_lodq(struct tgsi_exec_machine *mach,
           const struct tgsi_full_instruction *inst)
 {
    uint resource_unit, sampler_unit;
-   int dim;
-   int i;
+   unsigned dim;
+   unsigned i;
    union tgsi_exec_channel coords[4];
    const union tgsi_exec_channel *args[ARRAY_SIZE(coords)];
    union tgsi_exec_channel r[2];
-- 
2.16.4



More information about the mesa-dev mailing list