Implement stringify macro

And use it for `FW_ARCHITECTURE`. This is needed because with
Microchip's xc32, `-DFOO=\"bar\"` results in `FOO` being `bar`, not
`"bar"`, so we have to stringify differently.

PUBLISHED_FROM=d0aeebb55ef9e0e92a7f750104cd6600e0d9c636
This commit is contained in:
Dmitry Frank 2016-12-08 22:15:03 +00:00 committed by Cesanta Bot
parent 25de791424
commit 18ff0fafe0

View File

@ -1846,6 +1846,23 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst, int *dec_len);
#define CS_ENABLE_TO64 0
#endif
/*
* Expands to a string representation of its argument: e.g.
* `CS_STRINGIFY_LIT(5) expands to "5"`
*/
#define CS_STRINGIFY_LIT(x) #x
/*
* Expands to a string representation of its argument, which is allowed
* to be a macro: e.g.
*
* #define FOO 123
* CS_STRINGIFY_MACRO(FOO)
*
* expands to 123.
*/
#define CS_STRINGIFY_MACRO(x) CS_STRINGIFY_LIT(x)
#ifdef __cplusplus
extern "C" {
#endif