123456789101112131415161718192021 |
- #ifndef _ASSERT_MSG_H
- #define _ASSERT_MSG_H
- #include <stdio.h>
- #include <stdlib.h>
- #define assert_msg(M, X) ((void)((X) || \
- (__failed_msg((M), #X, __FILE__, __LINE__, __func__), 0)))
- _Noreturn static inline void
- __failed_msg(const char *msg, const char *expr, const char *file, int line,
- const char *func)
- {
- fprintf(stderr, "Assertion failed: %s: %s (%s: %s: %d)\n",
- msg, expr, file, func, line);
- abort();
- }
- #endif /* _ASSERT_MSG_H */
|