BUILD: introduce possibility to define ABORT_NOW() conditionally

code analysis tools recognize abort() better, so let us introduce
such possibility
This commit is contained in:
Ilya Shipitsin 2020-09-12 11:24:48 +05:00 committed by Willy Tarreau
parent adf6b977ce
commit 4a034f2212
2 changed files with 9 additions and 3 deletions

View File

@ -106,6 +106,7 @@
# SUBVERS : add a sub-version (eg: platform, model, ...).
# VERDATE : force haproxy's release date.
# VTEST_PROGRAM : location of the vtest program to run reg-tests.
# DEBUG_USE_ABORT: use abort() for program termination, see include/haproxy/bug.h for details
# verbosity: pass V=1 for verbose shell invocation
V = 0

View File

@ -37,10 +37,15 @@
#define DPRINTF(x...)
#endif
/* This abort is more efficient than abort() because it does not mangle the
* stack and stops at the exact location we need.
*/
#ifdef DEBUG_USE_ABORT
/* abort() is better recognized by code analysis tools */
#define ABORT_NOW() abort()
#else
/* More efficient than abort() because it does not mangle the
* stack and stops at the exact location we need.
*/
#define ABORT_NOW() (*(volatile int*)1=0)
#endif
/* BUG_ON: complains if <cond> is true when DEBUG_STRICT or DEBUG_STRICT_NOCRASH
* are set, does nothing otherwise. With DEBUG_STRICT in addition it immediately