[PATCH] Avoid gcc compiler warning
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 8, 2014, 16:38 UTC
- Message-ID
- <b9e1cb1f858e71b964be4f752fcebc22cd944ebc.1418056722.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1418056722.git.johannes.schindelin@gmx.de>
At least on this developer's MacOSX (Snow Leopard, gcc-4.2.1), GCC prints a warning that 'hash' may be used uninitialized when compiling test-hashmap that 'hash' may be used uninitialized (but GCC 4.6.3 on this developer's Ubuntu server does not report this problem).
Since hash() is called from perf_hashmap() which accepts an unchecked integer value from the command line, the warning appears to be legitimate, even if the test-hashmap command is only called from the test suite.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- test-hashmap.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/test-hashmap.c b/test-hashmap.c index 07aa7ec..40a126d 100644 --- a/test-hashmap.c +++ b/test-hashmap.c @@ -62,6 +62,8 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key) case HASH_METHOD_0: hash = 0; break; + default: + die("Unknown method: %d", method); } if (method & HASH_METHOD_X2)
-- 2.0.0.rc3.9669.g840d1f9