All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	git@vger.kernel.org, kasal@ucw.cz
Subject: Re: [PATCH] config.c: mark die_bad_number as NORETURN
Date: Wed, 16 Apr 2014 10:21:58 -0700	[thread overview]
Message-ID: <xmqq7g6pi409.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140416165146.GA16695@sigill.intra.peff.net> (Jeff King's message of "Wed, 16 Apr 2014 12:51:47 -0400")

Jeff King <peff@peff.net> writes:

> On Wed, Apr 16, 2014 at 06:38:19PM +0200, Torsten Bögershausen wrote:
>
>> > Does that also silence the warning?
>> > 
>> This works under gcc 4.2.1 Mac OS: the warning is away.
>
> Thanks. I couldn't test myself, as I could not get gcc to generate the
> warning in the first place, but I do not have anything as old as 4.2 on
> hand.
>
> Here it is with a commit message.
>
> -- >8 --
> Subject: config.c: mark die_bad_number as NORETURN
>
> This can help avoid -Wuninitialized false positives in
> git_config_int and git_config_ulong, as the compiler now
> knows that we do not return "ret" if we hit the error
> codepath.

Thanks for clearly solving the issue and describing the solution.
Will queue.

> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  config.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/config.c b/config.c
> index 6821cef..a30cb5c 100644
> --- a/config.c
> +++ b/config.c
> @@ -557,6 +557,7 @@ int git_parse_ulong(const char *value, unsigned long *ret)
>  	return 1;
>  }
>  
> +NORETURN
>  static void die_bad_number(const char *name, const char *value)
>  {
>  	const char *reason = errno == ERANGE ?

      reply	other threads:[~2014-04-16 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 14:13 [PATCH] config.c: fix a compiler warning Stepan Kasal
2014-04-16 15:29 ` Jeff King
2014-04-16 16:38   ` Torsten Bögershausen
2014-04-16 16:51     ` [PATCH] config.c: mark die_bad_number as NORETURN Jeff King
2014-04-16 17:21       ` Junio C Hamano [this message]

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=xmqq7g6pi409.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kasal@ucw.cz \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    /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.