[PATCH] Avoid gcc compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]