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.
This commit is contained in:
Tim Duesterhus 2021-01-25 17:51:36 +01:00 committed by Christopher Faulet
parent bde2bf6fd3
commit 3d7f9ff377
1 changed files with 4 additions and 0 deletions

View File

@ -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