usage: add NORETURN to BUG() function definitions
authorRamsay Jones <ramsay@ramsayjones.plus.com>
Sun, 21 May 2017 22:25:39 +0000 (23:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 May 2017 02:00:53 +0000 (11:00 +0900)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
usage.c
diff --git a/usage.c b/usage.c
index 7e6cb2028010d0b1c04bd1423a4de32fc759a4bd..1f63e033e99fe3325a96132bdc5b6514d951cecb 100644 (file)
--- 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);