aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-11 06:10:57 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-11 06:11:11 +0100
commit3f837c11f1e22ff4faea84da7e27b4c7ec7f8f1c (patch)
treeb45fb5c8b79abe5cf835b7cd9d7ebcbf85eb89d4 /src/libmdsserver
parentmds-kbdc: compile-layout: do not warn about non-shadowing after a for-loop (diff)
downloadmds-3f837c11f1e22ff4faea84da7e27b4c7ec7f8f1c.tar.gz
mds-3f837c11f1e22ff4faea84da7e27b4c7ec7f8f1c.tar.bz2
mds-3f837c11f1e22ff4faea84da7e27b4c7ec7f8f1c.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver')
-rw-r--r--src/libmdsserver/macros.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 7d661a1..e307384 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -37,6 +37,9 @@
*/
+/* # pragma GCC diagnostic ignored "-Wpedantic" */
+
+
/**
* Wrapper around `asprintf` that makes sure that first
* argument gets set to `NULL` on error and that zero is
@@ -49,6 +52,16 @@
*/
#define xasprintf(VAR, ...) \
(asprintf(&(VAR), __VA_ARGS__) < 0 ? (VAR = NULL, -1) : 0)
+/*
+#define xasprintf(VAR, ...) \
+ ({ \
+ int _x_rc = (asprintf(&(VAR), __VA_ARGS__) < 0 ? (VAR = NULL, -1) : 0); \
+ fprintf(stderr, "xasprintf(%s, %s)(=%zu) @ %s:%i\n", \
+ #VAR, #__VA_ARGS__, _x_rc ? 0 : (strlen(VAR) + 1), __FILE__, __LINE__); \
+ _x_rc; \
+ })
+*/
+
/**
* Wrapper for `snprintf` that allows you to forget about the buffer size