From: Junio C Hamano <gitster@pobox.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Jeff King <peff@peff.net>, GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] usage: add NORETURN to BUG() function definitions
Date: Mon, 22 May 2017 10:43:12 +0900 [thread overview]
Message-ID: <xmqqpof1psy7.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <4a5619af-d695-ab6c-e603-368e38827455@ramsayjones.plus.com> (Ramsay Jones's message of "Sun, 21 May 2017 23:25:39 +0100")
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> Commit d8193743e0 ("usage.c: add BUG() function", 12-05-2017) added the
> BUG() functions and macros as a replacement for calls to die("BUG: ..").
> The use of NORETURN on the declarations (in git-compat-util.h) and the
> lack of NORETURN on the function definitions, however, leads sparse to
> complain thus:
>
> SP usage.c
> usage.c:220:6: error: symbol 'BUG_fl' redeclared with different type
> (originally declared at git-compat-util.h:1074) - different modifiers
>
> In order to suppress the sparse error, add the NORETURN to the function
> definitions.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Junio,
>
> This is built on 'next', which has now merged the 'jk/bug-to-abort'
> branch.
Thanks.
I cannot seem to cause sparse (v0.5.0-207-g14964df) to complain the
same way, though.
>
> Thanks!
>
> ATB,
> Ramsay Jones
>
> usage.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/usage.c b/usage.c
> index 7e6cb2028..1f63e033e 100644
> --- a/usage.c
> +++ b/usage.c
> @@ -217,7 +217,7 @@ static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_lis
> }
>
> #ifdef HAVE_VARIADIC_MACROS
> -void BUG_fl(const char *file, int line, const char *fmt, ...)
> +NORETURN void BUG_fl(const char *file, int line, const char *fmt, ...)
> {
> va_list ap;
> va_start(ap, fmt);
> @@ -225,7 +225,7 @@ void BUG_fl(const char *file, int line, const char *fmt, ...)
> va_end(ap);
> }
> #else
> -void BUG(const char *fmt, ...)
> +NORETURN void BUG(const char *fmt, ...)
> {
> va_list ap;
> va_start(ap, fmt);
next prev parent reply other threads:[~2017-05-22 1:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-21 22:25 [PATCH] usage: add NORETURN to BUG() function definitions Ramsay Jones
2017-05-22 1:43 ` Junio C Hamano [this message]
2017-05-22 2:13 ` Ramsay Jones
2017-05-22 2:35 ` Junio C Hamano
2017-05-22 2:46 ` Junio C Hamano
2017-05-22 14:02 ` Ramsay Jones
2017-05-23 3:32 ` Junio C Hamano
2017-05-23 20:47 ` Ramsay Jones
2017-05-22 11:19 ` Jeff King
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=xmqqpof1psy7.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=ramsay@ramsayjones.plus.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