Re: [PATCH] Avoid gcc compiler warning
- From
Jeff King <peff@peff.net>
- Date
- Dec 9, 2014, 08:47 UTC
- Message-ID
- <20141209084728.GA13123@peff.net>
- In-Reply-To
- <b9e1cb1f858e71b964be4f752fcebc22cd944ebc.1418056722.git.johannes.schindelin@gmx.de>
On Mon, Dec 08, 2014 at 05:38:59PM +0100, Johannes Schindelin wrote:
Show 8 quoted lines
> 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