aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/macros.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-08 17:55:54 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-08 17:55:54 +0100
commitb7e3db26fd5c8ecabe927a12e8b2feecac92462d (patch)
tree5c1a22100fa5b3c7259fdb1ee91e26bd2018d898 /src/libmdsserver/macros.h
parentmds-kbdc: mark failing test cases (diff)
downloadmds-b7e3db26fd5c8ecabe927a12e8b2feecac92462d.tar.gz
mds-b7e3db26fd5c8ecabe927a12e8b2feecac92462d.tar.bz2
mds-b7e3db26fd5c8ecabe927a12e8b2feecac92462d.tar.xz
whenever fail_if gotos to the failure clause, print whence
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/macros.h6
1 files changed, 4 insertions, 2 deletions
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)
/**