Re: [PATCH] Avoid gcc compiler warning
From: Jeff King <hidden>
Date: 2016-06-15 23:03:15
On Mon, Dec 08, 2014 at 05:38:59PM +0100, Johannes Schindelin wrote:
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.
I think the older gcc is wrong; we are switching on "method & 3", which must be in the range 0-3 (and we cover all cases). I do not mind silencing the warning anyway, but see this discussion: http://thread.gmane.org/gmane.comp.version-control.git/258186 The thread seems very broken in gmane, but it continues here: http://article.gmane.org/gmane.comp.version-control.git/258232 http://thread.gmane.org/gmane.comp.version-control.git/258245 http://article.gmane.org/gmane.comp.version-control.git/258264 -Peff