diff options
author | Tim Duesterhus <tim@bastelstu.be> | 2021-01-25 17:51:36 +0100 |
---|---|---|
committer | Christopher Faulet <cfaulet@haproxy.com> | 2021-01-26 09:33:18 +0100 |
commit | 3d7f9ff377e406cdff55876e4f4f8e5a96448037 (patch) | |
tree | fff4b6c55187d7c7cd7fef00e13e5346b596f14c | |
parent | bde2bf6fd3455c372bccf139a703e81325367665 (diff) | |
download | haproxy-3d7f9ff377e406cdff55876e4f4f8e5a96448037.tar.gz |
MINOR: abort() on my_unreachable() when DEBUG_USE_ABORT is set.
Hopefully this helps static analysis tools detecting that the code after that
call is unreachable.
See GitHub Issue #1075.
-rw-r--r-- | include/haproxy/compiler.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index e5fae3e27..fba6dc358 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -66,11 +66,15 @@ * 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 |