Code: Select all
#if !defined(chDbgAssert)
#define chDbgAssert(c, r) do { \
/*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(__func__); \
} \
} \
} while (false)
#endif /* !defined(chDbgAssert) */
I find a reason displayed in a debugger quite helpful, although the __func__ is of course great information as well.
We have quickly hack-fixed it in our codebase by using sprintf to get both __func__ and the reason. Using the standard library is of course not ideal, but one could just manually concatenate or leave inserting __func__ to the caller.
What I'm wondering is, if there's a special reason for discarding r that I'm unaware of? Or is this just an oversight?
Kind regards
Lukas