All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Avoid gcc compiler warning
Date: Mon, 8 Dec 2014 17:38:59 +0100 (CET)	[thread overview]
Message-ID: <b9e1cb1f858e71b964be4f752fcebc22cd944ebc.1418056722.git.johannes.schindelin@gmx.de> (raw)
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

       reply	other threads:[~2014-12-08 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1418056722.git.johannes.schindelin@gmx.de>
2014-12-08 16:38 ` Johannes Schindelin [this message]
2014-12-09  8:47   ` [PATCH] Avoid gcc compiler warning Jeff King
2014-12-09  9:48     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9e1cb1f858e71b964be4f752fcebc22cd944ebc.1418056722.git.johannes.schindelin@gmx.de \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.