From 3d5469a2684f9b2e86ca0875187b9d11c117b39c Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Wed, 9 Oct 2019 19:44:41 +0200 Subject: [PATCH] fix compilation warnings with recent compiler --- src/ecoli_malloc.c | 6 +++++- src/ecoli_murmurhash.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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); }; -- 2.39.5