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