tools/reorder/test.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:324a01fc4028
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 extern "C" int mult(int l, int r);
6
7 extern "C" {
8
9 inline
10 int
11 farfle(int a, int b)
12 {
13 return a * b + a / b;
14 }
15
16 static
17 int
18 ballywhoo(int a, int b)
19 {
20 // So it can't get inlined
21 if (a > 4)
22 ballywhoo(a - 1, a + 1);
23
24 return a + b;
25 }
26
27 static
28 int
29 blimpyburger(char a, int b)
30 {
31 if (a == 'f')
32 return b;
33
34 return 0;
35 }
36
37 }
38
39 class foo
40 {
41 public:
42 static int get_flooby() { static int flooby = 12; return flooby; }
43
44 static int divide(int a, int b);
45
46 foo() {}
47 foo(int a);
48 virtual ~foo() {}
49
50 int bar();
51
52 int baz(int a) { return a ? baz(a - 1) : 0; }
53 };
54
55 foo::foo(int a)
56 {
57 }
58
59 int
60 foo::divide(int a, int b)
61 {
62 static int phlegm = 12;
63 return a / b * ++phlegm;
64 }
65
66 int
67 foo::bar()
68 {
69 return 12;
70 }
71
72 int main(int argc, char* argv[])
73 {
74 int a = mult(5, 4);
75 a = ballywhoo(5, 2);
76 a = farfle(a, 6);
77 a = blimpyburger('q', 4);
78
79 foo f;
80 f.get_flooby();
81 a = f.bar();
82
83 a = foo::divide(a, 12) + f.baz(6);
84
85 foo f2(12);
86 f2.baz(15);
87
88 return a > 99 ? 1 : 0;
89 }

mercurial