diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-01-26 20:13:39 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-01-26 20:14:34 +0100 |
commit | 5c58342886ffbf56544e5ae9e8dd3ac1d6e2c39f (patch) | |
tree | d4125b23d7d44b317d5cd1d5c6f6197857817255 /common.h | |
parent | 246c2746a25121ad51360f2ebb6c4b8073ea10e4 (diff) |
common: print the source location in mg2di_assert()
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -30,12 +30,16 @@ #define FD_STENCIL_MAX 4 -#define mg2di_assert(x) \ -do { \ - if (!(x)) { \ - fputs("Assertion " #x " failed\n", stderr); \ - abort(); \ - } \ +#define STRINGIFY(x) #x +#define SOURCE_LOC(f, l) f ":" STRINGIFY(l) + +#define mg2di_assert(x) \ +do { \ + if (!(x)) { \ + fputs(SOURCE_LOC(__FILE__, __LINE__) \ + ": " "Assertion " #x " failed\n", stderr); \ + abort(); \ + } \ } while (0) #endif /* MG2D_COMMON_H */ |