Skip to content

Commit

Permalink
Merge pull request #9136 from jcarrano/fix-assert
Browse files Browse the repository at this point in the history
core: make assert() an expression.
  • Loading branch information
kaspar030 committed May 15, 2018
2 parents d6c6359 + 09d1b2e commit 8fd0136
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions core/include/assert.h
Expand Up @@ -101,10 +101,7 @@ NORETURN void _assert_failure(const char *file, unsigned line);
*
* @see http://pubs.opengroup.org/onlinepubs/9699919799/functions/assert.html
*/
#define assert(cond) \
if (!(cond)) { \
_assert_failure(RIOT_FILE_RELATIVE, __LINE__); \
}
#define assert(cond) ((cond) ? (void)0 : _assert_failure(RIOT_FILE_RELATIVE, __LINE__))
#else
#define assert(cond) ((cond) ? (void)0 : core_panic(PANIC_ASSERT_FAIL, assert_crash_message))
#endif
Expand Down

0 comments on commit 8fd0136

Please sign in to comment.