From 5c6f9566ec7f8f0a0066cf423d63a7bdc0d7e599 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 31 Dec 2015 03:31:06 +0100 Subject: fix bugs and improve debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/common.h') 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 -- cgit v1.2.3-70-g09d2