aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/common.h b/src/common.h
index 375cf49..1401c37 100644
--- a/src/common.h
+++ b/src/common.h
@@ -35,7 +35,13 @@
*
* @param ... The statement.
*/
-# define t(...) do { if (__VA_ARGS__) goto fail; } while (0)
+# ifdef DEBUG
+# define t(...) do { if ((__VA_ARGS__) ? (failed__ = #__VA_ARGS__) : 0) { (perror)(failed__); goto fail; } } while (0)
+static const char *failed__ = NULL;
+# define perror(_) ((void)(_))
+# else
+# define t(...) do { if (__VA_ARGS__) goto fail; } while (0)
+# endif
#endif