mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
BUILD: debug: make sure debug macros are never empty
As outlined in commit f7ebe584d7 ("BUILD: debug: Add braces to if
statement calling only CHECK_IF()"), the BUG_ON() family of macros
is incorrectly defined to be empty when debugging is disabled, and
that can lead to trouble. Make sure they always fall back to the
usual "do { } while (0)". This may be backported to 2.6 if needed,
though no such issue was met there to date.
This commit is contained in:
parent
3ff9610356
commit
d8009a1ca6
@ -140,9 +140,9 @@ static inline __attribute((always_inline)) void ha_crash_now(void)
|
|||||||
# define CHECK_IF(cond) _BUG_ON_ONCE(cond, __FILE__, __LINE__, 1, "FATAL: check ", "")
|
# define CHECK_IF(cond) _BUG_ON_ONCE(cond, __FILE__, __LINE__, 1, "FATAL: check ", "")
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define BUG_ON(cond)
|
# define BUG_ON(cond) do { } while (0)
|
||||||
# define WARN_ON(cond)
|
# define WARN_ON(cond) do { } while (0)
|
||||||
# define CHECK_IF(cond)
|
# define CHECK_IF(cond) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These macros are only for hot paths and remain disabled unless DEBUG_STRICT is 2 or above.
|
/* These macros are only for hot paths and remain disabled unless DEBUG_STRICT is 2 or above.
|
||||||
@ -164,8 +164,8 @@ static inline __attribute((always_inline)) void ha_crash_now(void)
|
|||||||
# define CHECK_IF_HOT(cond) _BUG_ON_ONCE(cond, __FILE__, __LINE__, 1, "FATAL: check ", "")
|
# define CHECK_IF_HOT(cond) _BUG_ON_ONCE(cond, __FILE__, __LINE__, 1, "FATAL: check ", "")
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define BUG_ON_HOT(cond)
|
# define BUG_ON_HOT(cond) do { } while (0)
|
||||||
# define CHECK_IF_HOT(cond)
|
# define CHECK_IF_HOT(cond) do { } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user