xref: /illumos-gate/usr/src/tools/smatch/src/validation/preprocessor/preprocessor8.c (revision f52943a93040563107b95bccb9db87d9971ef47d)
1 #define A(x) ## x
2 #define B(x) x ##
3 #define C(x) x ## ## ##
4 #define D(x) x#y
5 #define E x#y
6 #define F(x,y) x x##y #x y
7 #define G a##b
8 #define H 1##2
9 #define I(x,y,z) x y z
10 "A(x)"			: A(x)
11 "B(x)"			: B(x)
12 "C(x)"			: C(x)
13 "D(x)"			: D(x)
14 "x#y"			: E
15 "ab GH \"G\" 12"	: F(G,H)
16 "a ## b"		: I(a,##,b)
17 /*
18  * check-name: Preprocessor #8
19  * check-command: sparse -E $file
20  *
21  * check-output-start
22 
23 "A(x)" : A(x)
24 "B(x)" : B(x)
25 "C(x)" : C(x)
26 "D(x)" : D(x)
27 "x#y" : x#y
28 "ab GH \"G\" 12" : ab GH "G" 12
29 "a ## b" : a ## b
30  * check-output-end
31  *
32  * check-error-start
33 preprocessor/preprocessor8.c:1:14: error: '##' cannot appear at the ends of macro expansion
34 preprocessor/preprocessor8.c:2:16: error: '##' cannot appear at the ends of macro expansion
35 preprocessor/preprocessor8.c:3:22: error: '##' cannot appear at the ends of macro expansion
36 preprocessor/preprocessor8.c:4:15: error: '#' is not followed by a macro parameter
37  * check-error-end
38  */
39