[virglrenderer-devel] [PATCH v2 13/15] gallium/aux/tgsi_ureg.c: Fix some -Wsign-compare warnings

Gert Wollny gert.wollny at collabora.com
Tue Jun 5 20:20:01 UTC 2018


tgsi/tgsi_ureg.c: In function 'ureg_DECL_sampler':
tgsi/tgsi_ureg.c:601:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       if (ureg->sampler[i].Index == nr)
                                  ^~
tgsi/tgsi_ureg.c: In function 'emit_decls':
tgsi/tgsi_ureg.c:1335:31: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
       if (ureg->properties[i] != ~0)
                               ^~
tgsi/tgsi_ureg.c: In function 'ureg_create':
../../../../src/gallium/auxiliary/tgsi/tgsi_ureg.c:1594:18: warning:
comparison between signed and unsigned integer expressions [-Wsign-
compare]
    for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)

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

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index b4423d4..51c7d04 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -598,7 +598,7 @@ struct ureg_src ureg_DECL_sampler( struct ureg_program *ureg,
    unsigned i;
 
    for (i = 0; i < ureg->nr_samplers; i++)
-      if (ureg->sampler[i].Index == nr)
+      if (ureg->sampler[i].Index == (int)nr)
          return ureg->sampler[i];
    
    if (i < PIPE_MAX_SAMPLERS) {
@@ -1332,7 +1332,7 @@ static void emit_decls( struct ureg_program *ureg )
    unsigned i;
 
    for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
-      if (ureg->properties[i] != ~0)
+      if (ureg->properties[i] != ~0u)
          emit_property(ureg, i, ureg->properties[i]);
 
    if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
@@ -1584,7 +1584,7 @@ void ureg_free_tokens( const struct tgsi_token *tokens )
 
 struct ureg_program *ureg_create( unsigned processor )
 {
-   int i;
+   uint i;
    struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
    if (ureg == NULL)
       goto no_ureg;
-- 
2.16.4



More information about the virglrenderer-devel mailing list