BUILD: bug: make BUG_ON() void to avoid a rare warning

When building without threads, the recently introduced BUG_ON(tid != 0)
turns to a constant expression that evaluates to 0 and that is not used,
resulting in this warning:

  src/connection.c: In function 'conn_free':
  src/connection.c:584:3: warning: statement with no effect [-Wunused-value]

This is because the whole thing is declared as an expression for clarity.
Make it return void to avoid this. No backport is needed.
This commit is contained in:
Willy Tarreau 2023-09-04 16:42:53 +02:00
parent 88988bb06c
commit 17a7baca07

View File

@ -103,7 +103,7 @@ static inline __attribute((always_inline)) void ha_crash_now(void)
__BUG_ON(cond, file, line, crash, pfx, sfx) __BUG_ON(cond, file, line, crash, pfx, sfx)
#define __BUG_ON(cond, file, line, crash, pfx, sfx) \ #define __BUG_ON(cond, file, line, crash, pfx, sfx) \
(unlikely(cond) ? ({ \ (void)(unlikely(cond) ? ({ \
complain(NULL, "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n", crash); \ complain(NULL, "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n", crash); \
if (crash & 1) \ if (crash & 1) \
ABORT_NOW(); \ ABORT_NOW(); \
@ -121,7 +121,7 @@ static inline __attribute((always_inline)) void ha_crash_now(void)
__BUG_ON_ONCE(cond, file, line, crash, pfx, sfx) __BUG_ON_ONCE(cond, file, line, crash, pfx, sfx)
#define __BUG_ON_ONCE(cond, file, line, crash, pfx, sfx) \ #define __BUG_ON_ONCE(cond, file, line, crash, pfx, sfx) \
(unlikely(cond) ? ({ \ (void)(unlikely(cond) ? ({ \
static int __match_count_##line; \ static int __match_count_##line; \
complain(&__match_count_##line, "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n", crash); \ complain(&__match_count_##line, "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n", crash); \
if (crash & 1) \ if (crash & 1) \