From: Marek Vasut Date: Sat, 28 Jul 2012 15:47:58 +0200 Subject: [U-Boot] [PATCH 1/2] COMMON: Add __stringify() function Message-ID: <1343483279-11572-1-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This function converts static number to string in preprocessor. This is useful as it allows higher usage of puts() in favour of printf() Signed-off-by: Marek Vasut Cc: Wolfgang Denk Cc: Mike Frysinger --- include/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/common.h b/include/common.h index d1dd65a..451917d 100644 --- a/include/common.h +++ b/include/common.h @@ -268,6 +268,13 @@ typedef void (interrupt_handler_t)(void *); const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +/** + * __stringify - preprocessor magic to return string from number + * @x: constant number + */ +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x) + /* * Function Prototypes */ -- 1.7.10.4