mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2026-01-28 01:47:21 +01:00
add some doxygen to hard_assert
This commit is contained in:
parent
2e2651f087
commit
e721a2eae1
2 changed files with 19 additions and 0 deletions
|
|
@ -38,6 +38,16 @@ extern "C" {
|
|||
|
||||
#ifdef NDEBUG
|
||||
extern void hard_assertion_failure(void);
|
||||
|
||||
/*! \brief Perform a runtime assertion always (i.e. not just when NDEBUG is undefined)
|
||||
* \ingroup pico_base
|
||||
*
|
||||
* This function is intended to provide useful information in debug builds like a normal asstion, but also
|
||||
* prevent execution proceeding in other builds
|
||||
*
|
||||
* In debug builds this is equivalent to \ref assert, however in release builds it calls \ref hard_assertion_failure
|
||||
* which, by default, just calls \ref panic with the string "Hard assert"
|
||||
*/
|
||||
static inline void hard_assert(bool condition, ...) {
|
||||
if (!condition)
|
||||
hard_assertion_failure();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,15 @@
|
|||
#include "pico/runtime_init.h"
|
||||
|
||||
|
||||
/*! \brief Handle a hard_assert condition failure
|
||||
* \ingroup pico_runtime
|
||||
*
|
||||
* This weak function provides the default implementation (call \ref panic with "Hard assert") for if a \ref hard_assert
|
||||
* condition fail in non debug builds. You can provide your own strong implementation to replace the default behavior
|
||||
*
|
||||
* \sa hard_assert
|
||||
*/
|
||||
|
||||
void __weak hard_assertion_failure(void) {
|
||||
panic("Hard assert");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue