From: Sami Kerola Date: Fri, 25 Apr 2014 20:36:58 +0000 (+0100) Subject: include/c.h: add macro to print definitions as string X-Git-Tag: v2.25-rc1~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff1aaf99663595c614fb706e4cf7d8382b38e940;p=thirdparty%2Futil-linux.git include/c.h: add macro to print definitions as string Signed-off-by: Sami Kerola --- diff --git a/include/c.h b/include/c.h index a192fb1dd6..6b8793a66f 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 */