I've just tried concatenation:
#define APOS '
#define CHAR2(a,b,c) a##b##c
#define CHAR1(a,b,c) CHAR2(a,b,c)
#define CHAR(x) CHAR1(APOS,x,APOS)
Unfortunately though, the preprocessor complains about an unterminated character. (and multicharacter if you have more than one character)
A way to just disable preprocessor errors: (there is no specific warning option for this)
-no-integrated-cpp -Xpreprocessor -w
Some compile-time optimization example with some other tricks:
#define id1_id HELP
#define id2_id OKAY
#define LIST(item,...) \
item(id1, ##__VA_ARGS__)\
item(id2, ##__VA_ARGS__)\
item(id1, ##__VA_ARGS__)\
#define CODE(id,id2,...) ((CHAR(id##_id) == CHAR(id2##_id)) ? 1 : 0) +
int main() { printf("%d\n", LIST(CODE,id1) 0); return 0; }
This returns "2", since there are two items that have id1.