From b7e3db26fd5c8ecabe927a12e8b2feecac92462d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 8 Dec 2014 17:55:54 +0100 Subject: whenever fail_if gotos to the failure clause, print whence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/macros.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index de539a2..84b6060 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -383,7 +383,9 @@ * * @param ... The condition */ -#define fail_if(...) if (__VA_ARGS__) goto pfail +#define fail_if(...) \ + if (__VA_ARGS__) \ + do { fprintf(stderr, "failure at %s:%i\n", __FILE__, __LINE__); goto pfail; } while (0) /** @@ -392,7 +394,7 @@ * @param condition The condition * @param instructions The instruction (semicolon-terminated) */ -#define exit_if(condition, instructions) if (condition) { instructions return 1; } +#define exit_if(condition, instructions) if (condition) do { instructions return 1; } while (0) /** -- cgit v1.2.3-70-g09d2