[Mesa-dev] [PATCH 3/5] util/hash: Silence comparison between signed and unsigned integer warnings in tests

Ian Romanick idr at freedesktop.org
Fri Feb 13 12:52:36 PST 2015


From: Ian Romanick <ian.d.romanick at intel.com>

delete_management.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
delete_management.c:69:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = size - 100; i < size; i++) {
                           ^
delete_management.c:79:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       assert(key_value(entry->key) >= size - 100 &&
                               ^
delete_management.c:79:70: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       assert(key_value(entry->key) >= size - 100 &&
                                                                      ^
insert_many.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
insert_many.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
insert_many.c:67:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    assert(ht->entries == size);
                  ^
random_entry.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/util/tests/hash_table/delete_management.c | 2 +-
 src/util/tests/hash_table/insert_many.c       | 2 +-
 src/util/tests/hash_table/random_entry.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/tests/hash_table/delete_management.c b/src/util/tests/hash_table/delete_management.c
index 1adddc9..127d81b 100644
--- a/src/util/tests/hash_table/delete_management.c
+++ b/src/util/tests/hash_table/delete_management.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
 {
    struct hash_table *ht;
    struct hash_entry *entry;
-   int size = 10000;
+   unsigned size = 10000;
    uint32_t keys[size];
    uint32_t i;
 
diff --git a/src/util/tests/hash_table/insert_many.c b/src/util/tests/hash_table/insert_many.c
index f2497e0..b07e408 100644
--- a/src/util/tests/hash_table/insert_many.c
+++ b/src/util/tests/hash_table/insert_many.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
 {
    struct hash_table *ht;
    struct hash_entry *entry;
-   int size = 10000;
+   unsigned size = 10000;
    uint32_t keys[size];
    uint32_t i;
 
diff --git a/src/util/tests/hash_table/random_entry.c b/src/util/tests/hash_table/random_entry.c
index d3034df..d1bc44a 100644
--- a/src/util/tests/hash_table/random_entry.c
+++ b/src/util/tests/hash_table/random_entry.c
@@ -53,7 +53,7 @@ main(int argc, char **argv)
 {
    struct hash_table *ht;
    struct hash_entry *entry;
-   int size = 10000;
+   unsigned size = 10000;
    uint32_t keys[size];
    uint32_t i, random_value;
 
-- 
2.1.0



More information about the mesa-dev mailing list