Small change to assert macro, added stdlib include
This commit is contained in:
parent
d96cf1edd8
commit
9ae9826930
1 changed files with 2 additions and 1 deletions
|
@ -12,12 +12,13 @@
|
||||||
#ifndef _ASSERT_H
|
#ifndef _ASSERT_H
|
||||||
#define _ASSERT_H
|
#define _ASSERT_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define assert(ignore) ((void) 0)
|
#define assert(ignore) ((void) 0)
|
||||||
#else
|
#else
|
||||||
#define assert(expression) (expression || (fprintf(stderr, "%s: %d: %s", __FILE__, __LINE__, __func__) && abort()))
|
#define assert(expression) (expression || (fprintf(stderr, "Assertion failed: %s: %d: %s", __FILE__, __LINE__, __func__) && abort()))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue