Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | // This file is compiled and linked into the S-record format. |
2 | ||
3 | #define FOO_MSG_LEN 80 | |
4 | ||
5 | class Foo { | |
6 | static int foos; | |
7 | int i; | |
8 | static const int len = FOO_MSG_LEN; | |
9 | char message[len]; | |
10 | public: | |
11 | static void init_foo (); | |
12 | static int nb_foos() { return foos; } | |
13 | Foo(); | |
14 | Foo( char* message); | |
15 | Foo(const Foo&); | |
16 | Foo & operator= (const Foo&); | |
17 | ~Foo (); | |
18 | }; | |
19 | ||
20 | static Foo static_foo( "static_foo"); | |
21 | ||
22 | int | |
23 | main () | |
24 | { | |
25 | Foo automatic_foo( "automatic_foo"); | |
26 | return 0; | |
27 | } | |
28 | ||
29 | void | |
30 | terminate(void) | |
31 | { | |
32 | /* This recursive call prevents a compiler warning that the noreturn | |
33 | function terminate actually does return. */ | |
34 | terminate (); | |
35 | } | |
36 | ||
37 | extern "C" { | |
38 | void | |
39 | __main () | |
40 | { | |
41 | } | |
42 | ||
43 | void | |
44 | __builtin_delete () | |
45 | { | |
46 | } | |
47 | ||
48 | void | |
49 | __builtin_new () | |
50 | { | |
51 | } | |
52 | ||
53 | void | |
54 | __throw () | |
55 | { | |
56 | } | |
57 | ||
58 | void | |
59 | __terminate () | |
60 | { | |
61 | } | |
62 | ||
63 | void *__eh_pc; | |
64 | ||
65 | void *** | |
66 | __get_dynamic_handler_chain () | |
67 | { | |
68 | return 0; | |
69 | } | |
70 | ||
71 | void * | |
72 | __get_eh_context () | |
73 | { | |
74 | return 0; | |
75 | } | |
76 | ||
77 | } | |
78 | ||
79 | int Foo::foos = 0; | |
80 | ||
81 | void Foo::init_foo () | |
82 | { | |
83 | foos = 80; | |
84 | } | |
85 | ||
86 | Foo::Foo () | |
87 | { | |
88 | i = ++foos; | |
89 | } | |
90 | ||
0cd9f5f0 | 91 | Foo::Foo (char*) |
252b5132 RH |
92 | { |
93 | i = ++foos; | |
94 | } | |
95 | ||
96 | Foo::Foo (const Foo& foo) | |
97 | { | |
98 | i = ++foos; | |
99 | for (int k = 0; k < FOO_MSG_LEN; k++) | |
100 | message[k] = foo.message[k]; | |
101 | } | |
102 | ||
103 | Foo& Foo::operator= (const Foo& foo) | |
104 | { | |
105 | for (int k = 0; k < FOO_MSG_LEN; k++) | |
106 | message[k] = foo.message[k]; | |
107 | return *this; | |
108 | } | |
109 | ||
110 | Foo::~Foo () | |
111 | { | |
112 | foos--; | |
113 | } |