diff options
Diffstat (limited to 'firmware/libcommon/include/assert.h')
-rw-r--r-- | firmware/libcommon/include/assert.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/firmware/libcommon/include/assert.h b/firmware/libcommon/include/assert.h index a52ffa9..22bb101 100644 --- a/firmware/libcommon/include/assert.h +++ b/firmware/libcommon/include/assert.h @@ -65,41 +65,41 @@ // Definitions //------------------------------------------------------------------------------ #if defined(NOASSERT) - #define ASSERT(...) - #define SANITY_CHECK(...) + #define ASSERT(...) + #define SANITY_CHECK(...) #else - #if (TRACE_LEVEL == 0) - /// Checks that the given condition is true, - /// otherwise stops the program execution. - /// \param condition Condition to verify. - #define ASSERT(condition) { \ - if (!(condition)) { \ - while (1); \ - } \ - } - - /// Performs the same duty as the ASSERT() macro - /// \param condition Condition to verify. - #define SANITY_CHECK(condition) ASSERT(condition, ...) - - #else - /// Checks that the given condition is true, otherwise displays an error - /// message and stops the program execution. - /// \param condition Condition to verify. - #define ASSERT(condition) { \ - if (!(condition)) { \ - printf("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \ - while (1); \ - } \ - } - #define SANITY_ERROR "Sanity check failed at %s:%d\n\r" - - /// Performs the same duty as the ASSERT() macro, except a default error - /// message is output if the condition is false. - /// \param condition Condition to verify. - #define SANITY_CHECK(condition) ASSERT(condition, SANITY_ERROR, __FILE__, __LINE__) - #endif + #if (TRACE_LEVEL == 0) + /// Checks that the given condition is true, + /// otherwise stops the program execution. + /// \param condition Condition to verify. + #define ASSERT(condition) { \ + if (!(condition)) { \ + while (1); \ + } \ + } + + /// Performs the same duty as the ASSERT() macro + /// \param condition Condition to verify. + #define SANITY_CHECK(condition) ASSERT(condition, ...) + + #else + /// Checks that the given condition is true, otherwise displays an error + /// message and stops the program execution. + /// \param condition Condition to verify. + #define ASSERT(condition) { \ + if (!(condition)) { \ + printf("-F- ASSERT: %s %s:%d\n\r", #condition, __BASE_FILE__, __LINE__); \ + while (1); \ + } \ + } + #define SANITY_ERROR "Sanity check failed at %s:%d\n\r" + + /// Performs the same duty as the ASSERT() macro, except a default error + /// message is output if the condition is false. + /// \param condition Condition to verify. + #define SANITY_CHECK(condition) ASSERT(condition, SANITY_ERROR, __FILE__, __LINE__) + #endif #endif |