]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: introduce possibility to define ABORT_NOW() conditionally
authorIlya Shipitsin <chipitsine@gmail.com>
Sat, 12 Sep 2020 06:24:48 +0000 (11:24 +0500)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Sep 2020 11:11:27 +0000 (13:11 +0200)
code analysis tools recognize abort() better, so let us introduce
such possibility

Makefile
include/haproxy/bug.h

index 48c59551123516d90d59aedebc1a94cb6d0b4798..c0645093c2b152cbaac2ace1c3de771cb6d85b06 100644 (file)
--- a/Makefile
+++ b/Makefile
 #   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
index a008126f5c85d9b88a0db665cfbf4d45f846af31..ad2018b13805d3d54ab09ecdf1fadfbb9afe2386 100644 (file)
 #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