File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ extern "C" {
38
38
39
39
#ifdef NDEBUG
40
40
extern void hard_assertion_failure (void );
41
+
42
+ /*! \brief Perform a runtime assertion always (i.e. not just when NDEBUG is undefined)
43
+ * \ingroup pico_base
44
+ *
45
+ * This function is intended to provide useful information in debug builds like a normal assertion, but also
46
+ * prevent execution proceeding in other builds
47
+ *
48
+ * In debug builds this is equivalent to \ref assert, however in release builds it calls \ref hard_assertion_failure
49
+ * which, by default, just calls \ref panic with the string "Hard assert"
50
+ */
41
51
static inline void hard_assert (bool condition , ...) {
42
52
if (!condition )
43
53
hard_assertion_failure ();
Original file line number Diff line number Diff line change 8
8
#include "pico/runtime_init.h"
9
9
10
10
11
+ /*! \brief Handle a hard_assert condition failure
12
+ * \ingroup pico_runtime
13
+ *
14
+ * This weak function provides the default implementation (call \ref panic with "Hard assert") for if a \ref hard_assert
15
+ * condition fail in non debug builds. You can provide your own strong implementation to replace the default behavior
16
+ *
17
+ * \sa hard_assert
18
+ */
19
+
11
20
void __weak hard_assertion_failure (void ) {
12
21
panic ("Hard assert" );
13
22
}
You can’t perform that action at this time.
0 commit comments