All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usage: add NORETURN to BUG() function definitions
@ 2017-05-21 22:25 Ramsay Jones
  2017-05-22  1:43 ` Junio C Hamano
  2017-05-22 11:19 ` [PATCH] usage: add NORETURN to BUG() function definitions Jeff King
  0 siblings, 2 replies; 24+ messages in thread
From: Ramsay Jones @ 2017-05-21 22:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, GIT Mailing-list


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!

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);
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-06-02  1:45 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-21 22:25 [PATCH] usage: add NORETURN to BUG() function definitions Ramsay Jones
2017-05-22  1:43 ` Junio C Hamano
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-06-01 20:27               ` [PATCH 0/3] -Wmemcpy-max-count & friends Luc Van Oostenryck
2017-06-01 20:27                 ` [PATCH 1/3] memcpy()'s byte count is unsigned Luc Van Oostenryck
2017-06-02  0:16                   ` Ramsay Jones
2017-06-02  1:17                     ` Luc Van Oostenryck
2017-06-01 20:27                 ` [PATCH 2/3] add support for -Wmemcpy-max-count Luc Van Oostenryck
2017-06-02  0:23                   ` Ramsay Jones
2017-06-02  0:33                     ` Luc Van Oostenryck
2017-06-01 20:27                 ` [PATCH 3/3] add support for -fmemcpy-max-count Luc Van Oostenryck
2017-06-02  0:30                   ` Ramsay Jones
2017-06-02  0:37                     ` Ramsay Jones
2017-06-02  0:38                     ` Luc Van Oostenryck
2017-06-02  1:42                       ` Ramsay Jones
2017-06-02  1:45                         ` Luc Van Oostenryck
2017-06-02  0:11                 ` [PATCH 0/3] -Wmemcpy-max-count & friends Ramsay Jones
2017-06-02  0:26                   ` Luc Van Oostenryck
2017-05-22 11:19 ` [PATCH] usage: add NORETURN to BUG() function definitions Jeff King

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.