gallium/aux/util: Fix some warnings
authorGert Wollny <gert.wollny@collabora.com>
Tue, 5 Jun 2018 11:59:04 +0000 (13:59 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Wed, 20 Jun 2018 09:08:28 +0000 (11:08 +0200)
util/u_cpu_detect.c: In function 'util_cpu_detect':
util/u_cpu_detect.c:377:30: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    if (util_cpu_caps.nr_cpus == ~0u)
                              ^~

util/u_hash_table.c:274:21: warning: unused parameter 'k' [-Wunused-
parameter]
 util_hash_inc(void *k, void *v, void *d)
                     ^
util/u_hash_table.c:274:30: warning: unused parameter 'v' [-Wunused-
parameter]
 util_hash_inc(void *k, void *v, void *d)
                              ^

util/u_tests.c: In function 'test_texture_barrier':
util/u_tests.c:652:25: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       for (int i = 0; i < num_samples / 2; i++) {
                         ^

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/gallium/auxiliary/util/u_cpu_detect.c
src/gallium/auxiliary/util/u_hash_table.c
src/gallium/auxiliary/util/u_tests.c

index 6a59f271a83a6e3aec2fd8abd2345ba6e3afa968..3c6ae4ea1a3cb0edd649a25feab2eddedb443b3c 100644 (file)
@@ -374,7 +374,7 @@ util_cpu_detect(void)
    }
 #elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN)
    util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
-   if (util_cpu_caps.nr_cpus == ~0u)
+   if (util_cpu_caps.nr_cpus == ~0)
       util_cpu_caps.nr_cpus = 1;
 #elif defined(PIPE_OS_BSD)
    {
index 77fa477e33a7c32c39a23cffe729f8de7f49e8aa..201b9a23b650baa8af5d51232f80de11ba99db53 100644 (file)
@@ -271,7 +271,7 @@ util_hash_table_foreach(struct util_hash_table *ht,
 
 
 static enum pipe_error
-util_hash_inc(void *k, void *v, void *d)
+util_hash_inc(UNUSED void *k, UNUSED void *v, void *d)
 {
    ++*(size_t *)d;
    return PIPE_OK;
index 293a4580a9f3ab528e16c7b5738db3b0ea20e8ce..bae3fa111a4697022b3a91c60a49aa9e3aac7c60 100644 (file)
@@ -649,7 +649,7 @@ test_texture_barrier(struct pipe_context *ctx, bool use_fbfetch,
       /* Vertex shader. */
       void *vs = util_set_passthrough_vertex_shader(cso, ctx, false);
 
-      for (int i = 0; i < num_samples / 2; i++) {
+      for (unsigned i = 0; i < num_samples / 2; i++) {
          float value;
 
          /* 2 consecutive samples should have the same color to test MSAA