Don't handle timeout inside gdb_test_multiple
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / namespace.cc
CommitLineData
66a55e80
DB
1namespace AAA {
2 char c;
3 int i;
4 int A_xyzq (int);
5 char xyzq (char);
6 class inA {
7 public:
8 int xx;
9 int fum (int);
10 };
ceeb3d5a
TT
11 enum SomeEnum {
12 ALPHA,
13 BETA,
14 DELTA
15 };
66a55e80
DB
16};
17
18int AAA::inA::fum (int i)
19{
20 return 10 + i;
21}
22
23namespace BBB {
24 char c;
25 int i;
26 int B_xyzq (int);
27 char xyzq (char);
28
29 namespace CCC {
30 char xyzq (char);
31 };
32
33 class Class {
34 public:
35 char xyzq (char);
36 int dummy;
37 };
38};
39
40int AAA::A_xyzq (int x)
41{
42 return 2 * x;
43}
44
45char AAA::xyzq (char c)
46{
47 return 'a';
48}
49
50
51int BBB::B_xyzq (int x)
52{
53 return 3 * x;
54}
55
56char BBB::xyzq (char c)
57{
58 return 'b';
59}
60
61char BBB::CCC::xyzq (char c)
62{
63 return 'z';
64}
65
66char BBB::Class::xyzq (char c)
67{
68 return 'o';
69}
70
71void marker1(void)
72{
73 return;
74}
75
1fcb5155
DC
76namespace
77{
78 int X = 9;
79
80 namespace G
81 {
82 int Xg = 10;
79c2c32d
DC
83
84 namespace
85 {
86 int XgX = 11;
87 }
1fcb5155
DC
88 }
89}
90
91namespace C
92{
93 int c = 1;
94 int shadow = 12;
95
63d06c5c
DC
96 class CClass {
97 public:
98 int x;
99 class NestedClass {
100 public:
101 int y;
102 };
103 };
104
37fc574a
DC
105 void ensureRefs () {
106 // NOTE (2004-04-23, carlton): This function is here only to make
107 // sure that GCC 3.4 outputs debug info for these classes.
108 static CClass *c = new CClass();
109 static CClass::NestedClass *n = new CClass::NestedClass();
110 }
111
1fcb5155
DC
112 namespace
113 {
114 int cX = 6;
115
116 namespace F
117 {
118 int cXf = 7;
79c2c32d
DC
119
120 namespace
121 {
122 int cXfX = 8;
123 }
1fcb5155
DC
124 }
125 }
126
127 namespace C
128 {
129 int cc = 2;
130 }
131
79c2c32d
DC
132 namespace E
133 {
134 int ce = 4;
135 }
136
1fcb5155
DC
137 namespace D
138 {
139 int cd = 3;
140 int shadow = 13;
141
142 namespace E
143 {
144 int cde = 5;
145 }
146
147 void marker2 (void)
148 {
149 // NOTE: carlton/2003-04-23: I'm listing the expressions that I
150 // plan to have GDB try to print out, just to make sure that the
151 // compiler and I agree which ones should be legal! It's easy
152 // to screw up when testing the boundaries of namespace stuff.
153 c;
154 //cc;
155 C::cc;
156 cd;
79c2c32d 157 //C::D::cd;
1fcb5155
DC
158 E::cde;
159 shadow;
79c2c32d 160 //E::ce;
1fcb5155
DC
161 cX;
162 F::cXf;
79c2c32d 163 F::cXfX;
1fcb5155
DC
164 X;
165 G::Xg;
166 //cXOtherFile;
167 //XOtherFile;
79c2c32d 168 G::XgX;
1fcb5155
DC
169
170 return;
171 }
172
173 }
174}
66a55e80 175
0219b378
DJ
176extern int ensureOtherRefs ();
177
66a55e80
DB
178int main ()
179{
180 using AAA::inA;
181 char c1;
ceeb3d5a 182 AAA::SomeEnum var = AAA::ALPHA;
66a55e80
DB
183
184 using namespace BBB;
185
186 c1 = xyzq ('x');
187 c1 = AAA::xyzq ('x');
188 c1 = BBB::CCC::xyzq ('m');
189
190 inA ina;
191
192 ina.xx = 33;
193
194 int y;
195
196 y = AAA::A_xyzq (33);
197 y += B_xyzq (44);
198
199 BBB::Class cl;
200
201 c1 = cl.xyzq('e');
202
203 marker1();
204
1fcb5155 205 C::D::marker2 ();
0219b378
DJ
206
207 C::ensureRefs ();
208 ensureOtherRefs ();
66a55e80 209}
This page took 1.574844 seconds and 4 git commands to generate.