aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/common.h b/common.h
index 0c644bd..9c36a33 100644
--- a/common.h
+++ b/common.h
@@ -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 */