58 lines · c
1// Test typedef and global variable in function.2typedef struct {3 int a;4 int b;5} FooBar;6FooBar fb;7int f(int i) {8 if (fb.a) {9 fb.b = i;10 }11 return 1;12}13 14// Test enums.15enum B { x2 = 42,16 y2,17 z2 };18int enumCheck(void) {19 return x2;20}21 22// Test reporting an error in macro definition23#define MYMACRO(ctx) \24 ctx->a;25struct S {26 int a;27};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));36int inlineAsm(void) {37 int res;38 __asm__("mov $42, %0"39 : "=r"(res));40 return res;41}42 43// Implicit function.44int identImplicit(int in) {45 return in;46}47 48// ASTImporter doesn't support this construct.49int structInProto(struct DataType {int a;int b; } * d) {50 return 0;51}52 53int switchWithoutCases(int x) {54 switch (x) {55 };56 return 0;57}58