From: Willy Tarreau Date: Mon, 14 Nov 2022 06:18:42 +0000 (+0100) Subject: BUILD: hash: use __fallthrough in hash_djb2() X-Git-Tag: v2.7-dev9~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cff89874eac136c65e13cc6c63240db2358cf948;p=thirdparty%2Fhaproxy.git BUILD: hash: use __fallthrough in hash_djb2() This avoids 5 build warnings when preprocessing happens before compiling with gcc >= 7. --- diff --git a/src/hash.c b/src/hash.c index a20b90cc04..5c92e944f8 100644 --- a/src/hash.c +++ b/src/hash.c @@ -14,6 +14,7 @@ */ +#include #include @@ -62,12 +63,12 @@ unsigned int hash_djb2(const void *input, int len) hash = ((hash << 5) + hash) + *key++; } switch (len) { - case 7: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ - case 6: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ - case 5: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ - case 4: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ - case 3: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ - case 2: hash = ((hash << 5) + hash) + *key++; /* fallthrough... */ + case 7: hash = ((hash << 5) + hash) + *key++; __fallthrough; + case 6: hash = ((hash << 5) + hash) + *key++; __fallthrough; + case 5: hash = ((hash << 5) + hash) + *key++; __fallthrough; + case 4: hash = ((hash << 5) + hash) + *key++; __fallthrough; + case 3: hash = ((hash << 5) + hash) + *key++; __fallthrough; + case 2: hash = ((hash << 5) + hash) + *key++; __fallthrough; case 1: hash = ((hash << 5) + hash) + *key++; break; default: /* case 0: */ break; }