OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [debug/] [namespace1.C] - Blame information for rev 832

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test DWARF namespace support.
2
   This test case is based on GDB testsuite test case.  */
3
/* { dg-do compile } */
4
 
5
namespace AAA {
6
  char c;
7
  int i;
8
  int A_xyzq (int);
9
  char xyzq (char);
10
  class inA {
11
  public:
12
    int xx;
13
    int fum (int);
14
  };
15
};
16
 
17
int AAA::inA::fum (int i)
18
{
19
  return 10 + i;
20
}
21
 
22
namespace BBB {
23
  char c;
24
  int i;
25
  int B_xyzq (int);
26
  char xyzq (char);
27
 
28
  namespace CCC {
29
    char xyzq (char);
30
  };
31
 
32
  class Klasse {
33
  public:
34
    char xyzq (char);
35
    int dummy;
36
  };
37
};
38
 
39
int AAA::A_xyzq (int x)
40
{
41
  return 2 * x;
42
}
43
 
44
char AAA::xyzq (char c)
45
{
46
  return 'a';
47
}
48
 
49
 
50
int BBB::B_xyzq (int x)
51
{
52
  return 3 * x;
53
}
54
 
55
char BBB::xyzq (char c)
56
{
57
  return 'b';
58
}
59
 
60
char BBB::CCC::xyzq (char c)
61
{
62
  return 'z';
63
}
64
 
65
char BBB::Klasse::xyzq (char c)
66
{
67
  return 'o';
68
}
69
 
70
void marker1(void)
71
{
72
  return;
73
}
74
 
75
namespace
76
{
77
  int X = 9;
78
 
79
  namespace G
80
  {
81
    int Xg = 10;
82
 
83
    namespace
84
    {
85
      int XgX = 11;
86
    }
87
  }
88
}
89
 
90
namespace H
91
{
92
  int h = 14;
93
}
94
 
95
namespace I = H;
96
 
97
namespace J
98
{
99
  int j = 15;
100
}
101
 
102
using namespace J;
103
 
104
namespace K
105
{
106
  int k = 16;
107
}
108
 
109
namespace L
110
{
111
  using namespace K;
112
}
113
 
114
namespace O
115
{
116
  int o = 18;
117
}
118
 
119
namespace P
120
{
121
  using namespace O;
122
}
123
 
124
namespace Q
125
{
126
  using namespace P;
127
}
128
 
129
namespace R
130
{
131
  int r1 = 19;
132
  int r2 = 20;
133
}
134
 
135
using R::r1;
136
 
137
namespace C
138
{
139
  int c = 1;
140
  int shadow = 12;
141
 
142
  class CClass {
143
  public:
144
    int x;
145
    class NestedClass {
146
    public:
147
      int y;
148
    };
149
  };
150
 
151
  namespace
152
  {
153
    int cX = 6;
154
 
155
    namespace F
156
    {
157
      int cXf = 7;
158
 
159
      namespace
160
      {
161
        int cXfX = 8;
162
      }
163
    }
164
  }
165
 
166
  namespace C
167
  {
168
    int cc = 2;
169
  }
170
 
171
  namespace E
172
  {
173
    int ce = 4;
174
  }
175
 
176
  namespace D
177
  {
178
    int cd = 3;
179
    int shadow = 13;
180
 
181
    namespace E
182
    {
183
      int cde = 5;
184
    }
185
 
186
    namespace M
187
    {
188
      int cdm = 17;
189
    }
190
 
191
    using namespace M;
192
 
193
    void marker2 (void)
194
    {
195
      // NOTE: carlton/2003-04-23: I'm listing the expressions that I
196
      // plan to have GDB try to print out, just to make sure that the
197
      // compiler and I agree which ones should be legal!  It's easy
198
      // to screw up when testing the boundaries of namespace stuff.
199
      c;
200
      //cc;
201
      C::cc;
202
      cd;
203
      //C::D::cd;
204
      E::cde;
205
      shadow;
206
      //E::ce;
207
      cX;
208
      F::cXf;
209
      F::cXfX;
210
      X;
211
      G::Xg;
212
      //cXOtherFile;
213
      //XOtherFile;
214
      G::XgX;
215
      I::h;
216
      j;
217
      L::k;
218
      //k;
219
      cdm;
220
      Q::o;
221
      //o;
222
      r1;
223
      //r2;
224
 
225
      return;
226
    }
227
 
228
  }
229
}
230
 
231
int main ()
232
{
233
  using AAA::inA;
234
  char c1;
235
 
236
  using namespace BBB;
237
 
238
  c1 = xyzq ('x');
239
  c1 = AAA::xyzq ('x');
240
  c1 = BBB::CCC::xyzq ('m');
241
 
242
  inA ina;
243
 
244
  ina.xx = 33;
245
 
246
  int y;
247
 
248
  y = AAA::A_xyzq (33);
249
  y += B_xyzq (44);
250
 
251
  BBB::Klasse cl;
252
 
253
  c1 = cl.xyzq('e');
254
 
255
  marker1();
256
 
257
  C::D::marker2 ();
258
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.