Zesstra | e28b34f | 2021-08-21 23:04:07 +0200 | [diff] [blame] | 1 | // MorgenGrauen MUDlib |
| 2 | // |
| 3 | // assert.h -- assert macro |
| 4 | |
| 5 | #ifndef __ASSERT_H__ |
| 6 | #define __ASSERT_H__ |
| 7 | |
| 8 | #ifdef NDEBUG |
| 9 | #define assert(e,msg) |
| 10 | #else |
| 11 | #define assert(e,msg) \ |
| 12 | if (!(e)) \ |
| 13 | raise_error(sprintf( \ |
| 14 | "%s:%d in function %s: failed assertion `%s'\n", \ |
| 15 | __FILE__, __LINE__, __FUNCTION__, \ |
| 16 | stringp(msg) ? msg : "no details given")) |
| 17 | #endif |
| 18 | |
| 19 | #endif // __ASSERT_H__ |
| 20 | |
| 21 | #ifdef NEED_PROTOTYPES |
| 22 | |
| 23 | #ifndef __ASSERT_H_PROTO__ |
| 24 | #define __ASSERT_H_PROTO__ |
| 25 | |
| 26 | // prototypes |
| 27 | |
| 28 | #endif // __ASSERT_H_PROTO__ |
| 29 | |
| 30 | #endif // NEED_PROTOYPES |