1 /* MIT (BSD) license - see LICENSE file for details */
2 #ifndef CCAN_CPPMAGIC_H
3 #define CCAN_CPPMAGIC_H
6 * CPPMAGIC_NOTHING - expands to nothing
8 #define CPPMAGIC_NOTHING()
11 * CPPMAGIC_STRINGIFY - convert arguments to a string literal
13 #define _CPPMAGIC_STRINGIFY(...) #__VA_ARGS__
14 #define CPPMAGIC_STRINGIFY(...) _CPPMAGIC_STRINGIFY(__VA_ARGS__)
17 * CPPMAGIC_GLUE2 - glue arguments together
19 * CPPMAGIC_GLUE2(@a_, @b_)
20 * expands to the expansion of @a_ followed immediately
21 * (combining tokens) by the expansion of @b_
23 #define _CPPMAGIC_GLUE2(a_, b_) a_##b_
24 #define CPPMAGIC_GLUE2(a_, b_) _CPPMAGIC_GLUE2(a_, b_)
27 * CPPMAGIC_1ST - return 1st argument
29 * CPPMAGIC_1ST(@a_, ...)
30 * expands to the expansion of @a_
32 #define CPPMAGIC_1ST(a_, ...) a_
35 * CPPMAGIC_2ND - return 2nd argument
37 * CPPMAGIC_2ST(@a_, @b_, ...)
38 * expands to the expansion of @b_
40 #define CPPMAGIC_2ND(a_, b_, ...) b_
42 #endif /* CCAN_CPPMAGIC_H */