summaryrefslogtreecommitdiffstats
path: root/test/PCH/stmts.h
blob: 4267e2c2b3523c19110cef428fd89b460dc053c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Header for PCH test stmts.c

void f0(int x) { 
  // NullStmt
  ;
  // IfStmt
  if (x) {
  } else if (x + 1) {
  }

  switch (x) {
  case 0:
    x = 17;
    break;

  case 1:
    break;

  default:
    switch (x >> 1) {
    case 7:
      // fall through
    case 9:
      break;
    }
    x += 2;
    break;
  }

  while (x > 20) {
    if (x > 30) {
      --x;
      continue;
    } else if (x < 5)
      break;
    else
      goto done;
  }

  do {
    x++;
  } while (x < 10);

 almost_done:
  for (int y = x; y < 20; ++y) {
    if (x + y == 12)
      return;
    else if (x - y == 7)
      goto almost_done;
  }

 done:
  x = x + 2;

  int z = x, *y, j = 5;
}

int f1(int x) {
  switch (x) {
  case 17:
    return 12;

  default:
    break;
  }

  // variable-length array
  int array[x * 17 + 3];

  return x*2;
}

const char* what_is_my_name(void) { return __func__; }

int computed_goto(int x) {
 start:
  x = x << 1;
  void *location = &&start;

  if (x > 17)
    location = &&done;

  while (x > 12) {
    --x;
    if (x == 15)
      goto *location;
  }

  done:
  return 5;
}

#define maxint(a,b) ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
int weird_max(int x, int y) {
  return maxint(++x, --y);
}