public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Felipe Franciosi <felipe@paradoxo•org>
Cc: <git@vger•kernel.org>
Subject: Re: [PATCH] Initialise hash variable to prevent compiler warnings
Date: Mon, 13 Oct 2014 13:12:03 -0700	[thread overview]
Message-ID: <xmqq38ar3f1o.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1413211041-28732-1-git-send-email-felipe@paradoxo.org> (Felipe Franciosi's message of "Mon, 13 Oct 2014 15:37:21 +0100")

Felipe Franciosi <felipe@paradoxo•org> writes:

> The 'hash' variable in test-hashmap.c is not initialised properly
> which causes some 'gcc' versions to complain during compilation.

FNV/I/IDIV10/0 covers all the possibilities of (method & 3), I would
have to say that the compiler needs to be fixed.

Or insert "default:" just before "case HASH_METHOD_0:" line?

I dunno.

>
> Signed-off-by: Felipe Franciosi <felipe@paradoxo•org>
> ---
>  test-hashmap.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test-hashmap.c b/test-hashmap.c
> index 07aa7ec..cc2891d 100644
> --- a/test-hashmap.c
> +++ b/test-hashmap.c
> @@ -47,7 +47,7 @@ static struct test_entry *alloc_test_entry(int hash, char *key, int klen,
>  
>  static unsigned int hash(unsigned int method, unsigned int i, const char *key)
>  {
> -	unsigned int hash;
> +	unsigned int hash = 0;
>  	switch (method & 3)
>  	{
>  	case HASH_METHOD_FNV:

  reply	other threads:[~2014-10-13 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 14:37 [PATCH] Initialise hash variable to prevent compiler warnings Felipe Franciosi
2014-10-13 20:12 ` Junio C Hamano [this message]
     [not found]   ` <CANxchRS1mGapb77hc9Ywqj_-8UeexSAWK4UK9y9M76pvoN-Yeg@mail.gmail.com>
2014-10-13 21:55     ` Felipe Franciosi
2014-10-14  1:13     ` Junio C Hamano
2014-10-14 11:44       ` Felipe Franciosi
2014-10-14 16:41         ` Junio C Hamano

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=xmqq38ar3f1o.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=felipe@paradoxo$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox