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