1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core: Make assert be an expression.

The "verbose" alternative for assert() is now an expression and
can be used in all the places that a funcion call can be used.
This commit is contained in:
Juan Carrano 2018-05-15 14:24:28 +02:00
parent 33116c80d7
commit 09d1b2eac7

View File

@ -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