]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: debug: remove the unneeded do { } while (0) on __BUG_ON()
authorWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 14:51:11 +0000 (16:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 15:43:30 +0000 (17:43 +0200)
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.

include/haproxy/bug.h

index 20d6bd22c5a7c5c3d19723bf40f6cddbd01c4263..644d05cf57533857363c0baa0dbba0a6abc047b1 100644 (file)
@@ -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