Skip to content

Commit 59d2b02

Browse files
add some doxygen to hard_assert (#2582)
* add some doxygen to hard_assert * typo Co-authored-by: Peter Harper <[email protected]> --------- Co-authored-by: Peter Harper <[email protected]>
1 parent dad0112 commit 59d2b02

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/common/pico_base_headers/include/pico/assert.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ extern "C" {
3838

3939
#ifdef NDEBUG
4040
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+
*/
4151
static inline void hard_assert(bool condition, ...) {
4252
if (!condition)
4353
hard_assertion_failure();

src/rp2_common/pico_runtime/runtime.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
#include "pico/runtime_init.h"
99

1010

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+
1120
void __weak hard_assertion_failure(void) {
1221
panic("Hard assert");
1322
}

0 commit comments

Comments
 (0)