]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: abort() on my_unreachable() when DEBUG_USE_ABORT is set.
authorTim Duesterhus <tim@bastelstu.be>
Mon, 25 Jan 2021 16:51:36 +0000 (17:51 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Jan 2021 08:33:18 +0000 (09:33 +0100)
Hopefully this helps static analysis tools detecting that the code after that
call is unreachable.

See GitHub Issue #1075.

include/haproxy/compiler.h

index e5fae3e27fd6dc2419d32b144f0ea2eec08bb3c1..fba6dc35808db2c55af81e60c9eb29920ea5040e 100644 (file)
  * above which can more aggressively detect null dereferences. The builtin
  * below was introduced in gcc 4.5, and before it we didn't care.
  */
+#ifdef DEBUG_USE_ABORT
+#define my_unreachable() abort()
+#else
 #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define my_unreachable() __builtin_unreachable()
 #else
 #define my_unreachable()
 #endif
+#endif
 
 /* This macro may be used to block constant propagation that lets the compiler
  * detect a possible NULL dereference on a variable resulting from an explicit