foo(int x)1 static void foo(int x)
2 {
3 __context__(0); // OK
4 __context__(x, 0); // OK
5 __context__ (x, 1); // OK
6
7 __context__(x); // KO: no const expr
8 __context__(1,x); // KO: no const expr
9
10 __context__; // KO: no expression at all
11 __context__(; // KO: no expression at all
12
13 __context__ 0; // KO: need parens
14 __context__ x, 0; // KO: need parens
15 __context__(x, 0; // KO: unmatched parens
16 __context__ x, 0); // KO: unmatched parens
17 __context__(0; // KO: unmatched parens
18 __context__ 0); // KO: unmatched parens
19
20 __context__(); // KO: no expression at all
21 __context__(,0); // KO: no expression at all
22 __context__(x,); // KO: no expression at all
23 __context__(,); // KO: no expression at all
24 }
25
26 /*
27 * check-name: context-stmt
28 * check-command: sparse -Wno-context $file
29 *
30 * check-error-start
31 context-stmt.c:10:20: error: Expected ( after __context__ statement
32 context-stmt.c:10:20: error: got ;
33 context-stmt.c:11:21: error: expression expected after '('
34 context-stmt.c:11:21: error: got ;
35 context-stmt.c:11:21: error: Expected ) at end of __context__ statement
36 context-stmt.c:11:21: error: got ;
37 context-stmt.c:13:21: error: Expected ( after __context__ statement
38 context-stmt.c:13:21: error: got 0
39 context-stmt.c:14:21: error: Expected ( after __context__ statement
40 context-stmt.c:14:21: error: got x
41 context-stmt.c:15:25: error: Expected ) at end of __context__ statement
42 context-stmt.c:15:25: error: got ;
43 context-stmt.c:16:21: error: Expected ( after __context__ statement
44 context-stmt.c:16:21: error: got x
45 context-stmt.c:17:22: error: Expected ) at end of __context__ statement
46 context-stmt.c:17:22: error: got ;
47 context-stmt.c:18:21: error: Expected ( after __context__ statement
48 context-stmt.c:18:21: error: got 0
49 context-stmt.c:20:21: error: expression expected after '('
50 context-stmt.c:20:21: error: got )
51 context-stmt.c:21:21: error: expression expected after '('
52 context-stmt.c:21:21: error: got ,
53 context-stmt.c:22:23: error: expression expected after ','
54 context-stmt.c:22:23: error: got )
55 context-stmt.c:23:21: error: expression expected after '('
56 context-stmt.c:23:21: error: got ,
57 context-stmt.c:23:22: error: expression expected after ','
58 context-stmt.c:23:22: error: got )
59 context-stmt.c:7:21: error: bad constant expression
60 context-stmt.c:8:23: error: bad constant expression
61 * check-error-end
62 */
63