]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: pass the type to the __BUG_ON*() macros
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2026 06:58:20 +0000 (08:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 15:43:30 +0000 (17:43 +0200)
We now pass DBG_BUG or DBG_BUG_ONCE to the __BUG_ON*() macros, so that
we can later exploit this info to merge them.

include/haproxy/bug.h

index c506ee7e00b3f7d5ab48911765ce9393fd3c7efe..dcfeea58b3b6864095dd4a8371fb0b1980349607 100644 (file)
@@ -405,11 +405,11 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt  HA_SECTION_S
 #define _BUG_ON(cond, file, line, details, ...)                                        \
        (void)(unlikely(cond) ? ({                                              \
                __DBG_COUNT(cond, file, line, DBG_BUG, __VA_ARGS__);            \
-               __BUG_ON(cond, file, line, details, __VA_ARGS__);               \
+               __BUG_ON(cond, file, line, DBG_BUG, details, __VA_ARGS__);      \
                1; /* let's return the true condition */                        \
        }) : 0)
 
-#define __BUG_ON(cond, file, line, details, ...) do {                  \
+#define __BUG_ON(cond, file, line, type, details, ...) do {            \
                const char *msg;                                        \
                if (sizeof("" __VA_ARGS__) > 1)                         \
                        msg = "\"" #cond "\" matched at " file ":" #line "\x1e" __VA_ARGS__; \
@@ -430,11 +430,11 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt  HA_SECTION_S
 #define _BUG_ON_ONCE(cond, file, line, details, ...)                           \
        (void)(unlikely(cond) ? ({                                              \
                __DBG_COUNT(cond, file, line, DBG_BUG_ONCE, __VA_ARGS__);       \
-               __BUG_ON_ONCE(cond, file, line, details, __VA_ARGS__);          \
+               __BUG_ON_ONCE(cond, file, line, DBG_BUG_ONCE, details, __VA_ARGS__); \
                1; /* let's return the true condition */                        \
        }) : 0)
 
-#define __BUG_ON_ONCE(cond, file, line, details, ...) do {             \
+#define __BUG_ON_ONCE(cond, file, line, type, details, ...) do {       \
                static int __match_count_##line;                        \
                const char *msg;                                        \
                if (sizeof("" __VA_ARGS__) > 1)                         \