Skip to content

Commit

Permalink
usage: add NORETURN to BUG() function definitions
Browse files Browse the repository at this point in the history
Commit d819374 ("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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
ramsay-jones authored and gitster committed May 22, 2017
1 parent 25cd291 commit 3d7dd2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions usage.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ 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);
BUG_vfl(file, line, fmt, ap);
va_end(ap);
}
#else
void BUG(const char *fmt, ...)
NORETURN void BUG(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
Expand Down

0 comments on commit 3d7dd2d

Please sign in to comment.