From: Arun Thomas Date: Mon, 30 Aug 2010 14:34:58 +0000 (+0000) Subject: cdefs.h: Allow __CONCAT() macro to be nested X-Git-Tag: v3.1.8~33 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch06.html?a=commitdiff_plain;h=36fb30dfef8d99f00ab48e1c3efdede0b8ab413a;p=minix.git cdefs.h: Allow __CONCAT() macro to be nested --- diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index c982b3307..f030bbce1 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -78,9 +78,11 @@ /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. - * The __CONCAT macro is a bit tricky -- make sure you don't put spaces - * in between its arguments. __CONCAT can also concatenate double-quoted - * strings produced by the __STRING macro, but this only works with ANSI C. + * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI + * mode -- there must be no spaces between its arguments, and for nested + * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also + * concatenate double-quoted strings produced by the __STRING macro, but + * this only works with ANSI C. */ #define ___STRING(x) __STRING(x) @@ -88,7 +90,8 @@ #if __STDC__ || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ -#define __CONCAT(x,y) x ## y +#define __CONCAT1(x,y) x ## y +#define __CONCAT(x,y) __CONCAT1(x,y) #define __STRING(x) #x #define __const const /* define reserved names to standard */