From: Willy Tarreau Date: Thu, 13 Aug 2026 14:51:11 +0000 (+0200) Subject: CLEANUP: debug: remove the unneeded do { } while (0) on __BUG_ON() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49f863757d5b3ecf027c10ec01a5abce4d51adcc;p=thirdparty%2Fhaproxy.git CLEANUP: debug: remove the unneeded do { } while (0) on __BUG_ON() The macro is exclusively called by the _BUG_ON*() macros so it cannot appear anywhere else, no need to clutter the emitted syntax for nothing, seeing the output of the preprocessor on these parts is totally scary already. --- diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index 20d6bd22c..644d05cf5 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -410,7 +410,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S }) : 0) /* This is called by _BUG_ON() and _BUG_ON_ONCE() to handle the event. */ -#define __BUG_ON(cond, file, line, type, details, ...) do { \ +#define __BUG_ON(cond, file, line, type, details, ...) { \ const char *msg; \ if (sizeof("" __VA_ARGS__) > 1) \ msg = "\"" #cond "\" matched at " file ":" #line "\x1e" __VA_ARGS__; \ @@ -425,7 +425,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S else if (details & DBG_DET_FAT_WARN) \ ha_backtrace_to_stderr(0); \ } \ - } while (0) + } /* This one is equivalent except that it only emits the message once by * maintaining a static counter. This may be used with warnings to detect