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