From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@jeffhostetler.com, git@vger.kernel.org,
Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH] t/helper/test-lazy-name-hash: fix compilation
Date: Fri, 22 Dec 2017 10:15:59 -0800 [thread overview]
Message-ID: <xmqq7etetyqo.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171220222416.130872-1-sbeller@google.com> (Stefan Beller's message of "Wed, 20 Dec 2017 14:24:16 -0800")
Stefan Beller <sbeller@google.com> writes:
> I was compiling origin/master today with the DEVELOPER compiler flags
> today and was greeted by
>
> t/helper/test-lazy-init-name-hash.c: In function ‘cmd_main’:
> t/helper/test-lazy-init-name-hash.c:172:5: error: ‘nr_threads_used’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> printf("avg [size %8d] [single %f] %c [multi %f %d]\n",
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> nr,
> ~~~
> (double)avg_single/1000000000,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> (avg_single < avg_multi ? '<' : '>'),
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> (double)avg_multi/1000000000,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> nr_threads_used);
> ~~~~~~~~~~~~~~~~
> t/helper/test-lazy-init-name-hash.c:115:6: note: ‘nr_threads_used’ was declared here
> int nr_threads_used;
> ^~~~~~~~~~~~~~~
>
> Fix this issue by assigning 0 to 'nr_threads_used'.
>
> Acked-by: Jonathan Tan <jonathantanmy@google.com>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> Slightly reworded the commit message. I'd really like this patch to be included
> such that I can compile git with the DEVELOPER_CFLAGS flags.
Heh; I do not think there particularly is much difference between
stricter flags and DEVELOPER flags, but I would rather not lose the
removal of duplicated 'today' I did while I queued the previous one
;-)
>
> t/helper/test-lazy-init-name-hash.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
> index 6368a89345..297fb01d61 100644
> --- a/t/helper/test-lazy-init-name-hash.c
> +++ b/t/helper/test-lazy-init-name-hash.c
> @@ -112,7 +112,7 @@ static void analyze_run(void)
> {
> uint64_t t1s, t1m, t2s, t2m;
> int cache_nr_limit;
> - int nr_threads_used;
> + int nr_threads_used = 0;
> int i;
> int nr;
next prev parent reply other threads:[~2017-12-22 18:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-18 21:49 [FYI PATCH] t/helper/test-lazy-name-hash: fix compilation Stefan Beller
2017-12-18 23:43 ` Jonathan Tan
2017-12-19 14:19 ` Jeff Hostetler
2017-12-20 22:24 ` [PATCH] " Stefan Beller
2017-12-22 18:15 ` Junio C Hamano [this message]
2017-12-22 18:17 ` Stefan Beller
2017-12-22 20:02 ` 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=xmqq7etetyqo.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=jeffhost@microsoft.com \
--cc=sbeller@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).