From: Olivier Matz Date: Wed, 9 Oct 2019 17:44:41 +0000 (+0200) Subject: fix compilation warnings with recent compiler X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=commitdiff_plain;h=3d5469a2684f9b2e86ca0875187b9d11c117b39c fix compilation warnings with recent compiler --- diff --git a/src/ecoli_malloc.c b/src/ecoli_malloc.c index 5a022ae..e7f02df 100644 --- a/src/ecoli_malloc.c +++ b/src/ecoli_malloc.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -164,7 +165,10 @@ static int ec_malloc_testcase(void) ec_free_func(ptr); ptr = NULL; - ptr = ec_calloc(2, (size_t)-1); + /* here we use atoll() instead of a constant because we want to + * prevent the compiler to check the overflow at compilation + * time */ + ptr = ec_calloc(2, atoll("0xffffffffffffffff")); EC_TEST_CHECK(ptr == NULL, "bad overflow check in ec_calloc\n"); return testres; diff --git a/src/ecoli_murmurhash.c b/src/ecoli_murmurhash.c index 7aafece..8b45f6e 100644 --- a/src/ecoli_murmurhash.c +++ b/src/ecoli_murmurhash.c @@ -27,8 +27,8 @@ uint32_t ec_murmurhash3(const void *key, int len, uint32_t seed) k1 = 0; switch(len & 3) { - case 3: k1 ^= tail[2] << 16; - case 2: k1 ^= tail[1] << 8; + case 3: k1 ^= tail[2] << 16; /* fallthrough */ + case 2: k1 ^= tail[1] << 8; /* fallthrough */ case 1: k1 ^= tail[0]; h1 = ec_murmurhash3_add32(h1, k1); };