summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
authorSami Kerola2014-04-25 22:36:58 +0200
committerSami Kerola2014-05-04 12:42:03 +0200
commitff1aaf99663595c614fb706e4cf7d8382b38e940 (patch)
tree50a8cc8d33456db5916260a1d1872d8740dd9b6e /include/c.h
parentlast: fix is_phantom() detection (diff)
downloadkernel-qcow2-util-linux-ff1aaf99663595c614fb706e4cf7d8382b38e940.tar.gz
kernel-qcow2-util-linux-ff1aaf99663595c614fb706e4cf7d8382b38e940.tar.xz
kernel-qcow2-util-linux-ff1aaf99663595c614fb706e4cf7d8382b38e940.zip
include/c.h: add macro to print definitions as string
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index a192fb1dd..6b8793a66 100644
--- a/include/c.h
+++ b/include/c.h
@@ -307,4 +307,13 @@ static inline int xusleep(useconds_t usec)
# define SEEK_HOLE 4
#endif
+
+/*
+ * Macros to convert #define'itions to strings, for example
+ * #define XYXXY 42
+ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY));
+ */
+#define stringify_value(s) stringify(s)
+#define stringify(s) #s
+
#endif /* UTIL_LINUX_C_H */