]> git.kaiwu.me - haproxy.git/commit
MINOR: debug: use bit fields for the debug type and fatality
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Aug 2026 14:16:34 +0000 (16:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 15:43:30 +0000 (17:43 +0200)
commit8feda218d891a5358cec1273a2a821a0403d7011
tree82a674a3df28cc23aecff9c09841075358b5e556
parentacbf369e678d5fdc83a7f3bd1630c4fa9f7552d2
MINOR: debug: use bit fields for the debug type and fatality

Till now the BUG_ON() series of macros has been relying on magic values
0,1,2, and 3 passed down the chain to decide whether to log a bug or a
warning, and whether to crash or just warn. But this doesn't capture the
whole usage and is causing difficulties because we also have type "check",
and these values are passed to variables historically named "crash" or
"taint" suggesting booleans while bit-exact checks have to be done.

Let's replace them with a combination that separately indicates:
  - the type (check, warning, bug, abort), one bit per type, expected
    to be exclusive
  - type fatality (warning or fatal), one bit per level, must be
    exclusive as well

This allows us to easily replace the checks and map the numbers to their
equivalent definitions. The macros are called DBG_DET_* (debug details),
and the "crash" and "taint" fields have been renamed "details" as well.

For now this is the exact equivalent of what we previously had.
include/haproxy/bug.h
src/debug.c