mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
add some doxygen to hard_assert (#2582)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
* add some doxygen to hard_assert * typo Co-authored-by: Peter Harper <77111776+peterharperuk@users.noreply.github.com> --------- Co-authored-by: Peter Harper <77111776+peterharperuk@users.noreply.github.com>
This commit is contained in:
parent
dad01128f4
commit
59d2b0228b
2 changed files with 19 additions and 0 deletions
|
|
@ -38,6 +38,16 @@ extern "C" {
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
extern void hard_assertion_failure(void);
|
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 assertion, 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, ...) {
|
static inline void hard_assert(bool condition, ...) {
|
||||||
if (!condition)
|
if (!condition)
|
||||||
hard_assertion_failure();
|
hard_assertion_failure();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,15 @@
|
||||||
#include "pico/runtime_init.h"
|
#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) {
|
void __weak hard_assertion_failure(void) {
|
||||||
panic("Hard assert");
|
panic("Hard assert");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue