From: Andrew Deason Date: Mon, 5 Feb 2018 06:07:10 +0000 (-0600) Subject: util: Add the AFS_STRINGIZE() macro X-Git-Tag: upstream/1.8.1_pre2^2~70 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=902e70a30a87aaabe468f48a792729effdc94f1b;p=packages%2Fo%2Fopenafs.git util: Add the AFS_STRINGIZE() macro Add a macro to help with easily printing the value of #define'd constants, called AFS_STRINGIZE(). For example: printf("The value of AFS_SYSCALL is: " AFS_STRINGIZE(AFS_SYSCALL) "\n"); Reviewed-on: https://gerrit.openafs.org/12893 Tested-by: BuildBot Reviewed-by: Ian Wienand Reviewed-by: Benjamin Kaduk (cherry picked from commit f5794e029903db79f345f42582230a1fd0f7d823) Change-Id: I33d14a62a04c0f79521ec253d51587952bf909a3 Reviewed-on: https://gerrit.openafs.org/13091 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- diff --git a/src/util/afsutil.h b/src/util/afsutil.h index bd78946b4..bbebcc16d 100644 --- a/src/util/afsutil.h +++ b/src/util/afsutil.h @@ -121,6 +121,11 @@ extern int re_exec(const char *p1); /* b64_string_t is 8 bytes, in stds.h */ typedef char lb64_string_t[12]; +/* A simple macro to help show the value of #define'd constants. e.g. If 'FOO' + * is defined as 5, then AFS_STRINGIZE(FOO) expands to "5" */ +#define AFS_STRINGIZE_(s) #s +#define AFS_STRINGIZE(s) AFS_STRINGIZE_(s) + #include #include "afsutil_prototypes.h"