HPCToolkit
ppcat+ppstr.h
Go to the documentation of this file.
1 #ifndef PPCAT_PPSTR_H
2 #define PPCAT_PPSTR_H
3 
4 // Add several Levels of indirection for cpp token pasting (##),
5 // and stringize (#) operators.
6 // These macros are to facilitate other macro definitions that use these features.
7 // (The indirection is necessary due to quirkyness of cpp expansion algorithm).
8 //
9 // If another level of indirection is needed, then add another line
10 // to the auxiliary functions, and change the main definition to
11 // use the new level.
12 //
13 // Example:
14 // Add line
15 // #define __CAT3_(a, b) __CAT2_(a, b)
16 //
17 // Then change definition of PPCAT to
18 // #define PPCAT(a, b) __CAT3_(a, b)
19 
20 #define __CAT0_(a, b) a ## b
21 #define __CAT1_(a, b) __CAT0_(a, b)
22 #define __CAT2_(a, b) __CAT1_(a, b)
23 
24 #define PPCAT(a, b) __CAT2_(a, b)
25 
26 #define __STR0_(a) #a
27 #define __STR1_(a) __STR0_(a)
28 #define __STR2_(a) __STR1_(a)
29 
30 #define PPSTR(a) __STR2_(a)
31 
32 #endif // PPCAT_PPSTR_H