[Mesa-dev] [PATCH v2 04/29] gallium/aux/util/u_dump_defines.c: Fix -Wcompare-unsigned warning

Gert Wollny gw.fossdev at gmail.com
Thu Nov 16 15:09:37 UTC 2017


u_bit_scan may return -1 that then may be interpreted as (unsigned)-1 in
the following comparison, since num_names is unsigned. Convert the latter to
be int as well.

Signed-off-by: Gert Wollny <gw.fossdev at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
 src/gallium/auxiliary/util/u_dump_defines.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c
index e431cd969b..50dfa37bab 100644
--- a/src/gallium/auxiliary/util/u_dump_defines.c
+++ b/src/gallium/auxiliary/util/u_dump_defines.c
@@ -99,7 +99,7 @@ util_dump_flags_continuous(FILE *stream, unsigned value, unsigned num_names,
 
    while (value) {
       int i = u_bit_scan(&value);
-      if (i >= num_names || !names[i])
+      if (i >= (int)num_names || !names[i])
          unknown |= 1u << i;
       if (!first)
          fputs("|", stream);
-- 
2.13.6



More information about the mesa-dev mailing list