1 | // Test typedef and global variable in function. |
2 | typedef struct { |
3 | int a; |
4 | int b; |
5 | } FooBar; |
6 | FooBar fb; |
7 | int f(int i) { |
8 | if (fb.a) { |
9 | fb.b = i; |
10 | } |
11 | return 1; |
12 | } |
13 | |
14 | // Test enums. |
15 | enum B { x = 42, |
16 | l, |
17 | s }; |
18 | int enumCheck(void) { |
19 | return x; |
20 | } |
21 | |
22 | // Test reporting an error in macro definition |
23 | #define MYMACRO(ctx) \ |
24 | ctx->a; |
25 | struct S { |
26 | int a; |
27 | }; |
28 | int g(struct S *ctx) { |
29 | MYMACRO(ctx); |
30 | return 0; |
31 | } |
32 | |
33 | // Test that asm import does not fail. |
34 | int inlineAsm() { |
35 | int res; |
36 | asm("mov $42, %0" |
37 | : "=r"(res)); |
38 | return res; |
39 | } |
40 | |
41 | // Implicit function. |
42 | int identImplicit(int in) { |
43 | return in; |
44 | } |
45 | |
46 | // ASTImporter doesn't support this construct. |
47 | int structInProto(struct DataType {int a;int b; } * d) { |
48 | return 0; |
49 | } |
50 | |