ignore invalid DOF provider sections
[binutils-gdb.git] / gdb / testsuite / gdb.cp / cplusfuncs.cc
blob021d7c11dad816af350b923f27e5c12b942ecfc2
1 #include <stddef.h>
3 class foo {
4 public:
5 foo (int);
6 foo (int, const char *);
7 foo (foo&);
8 ~foo ();
10 void operator * (foo&);
11 void operator % (foo&);
12 void operator - (foo&);
13 void operator >> (foo&);
14 void operator != (foo&);
15 void operator > (foo&);
16 void operator >= (foo&);
17 void operator | (foo&);
18 void operator && (foo&);
19 void operator ! (void);
20 void operator ++ (int);
21 void operator = (foo&);
22 void operator += (foo&);
23 void operator *= (foo&);
24 void operator %= (foo&);
25 void operator >>= (foo&);
26 void operator |= (foo&);
27 void operator , (foo&);
28 void operator / (foo&);
29 void operator + (foo&);
30 void operator << (foo&);
31 void operator == (foo&);
32 void operator < (foo&);
33 void operator <= (foo&);
34 void operator & (foo&);
35 void operator ^ (foo&);
36 void operator || (foo&);
37 void operator ~ (void);
38 void operator -- (int);
39 foo* operator -> (void);
40 void operator -= (foo&);
41 void operator /= (foo&);
42 void operator <<= (foo&);
43 void operator &= (foo&);
44 void operator ^= (foo&);
45 void operator ->* (foo&);
46 void operator [] (foo&);
47 void operator () (foo&);
48 void* operator new (size_t) throw ();
49 void* operator new[] (size_t) throw ();
50 void operator delete (void *);
51 void operator delete[] (void *);
52 /**/ operator int ();
53 /**/ operator char* ();
55 int foofunc (int); // forced to have int return type, which is required
56 int foofunc (int, signed char *); // forced to have int return type, which is required
57 int ifoo;
58 const char *ccpfoo;
61 int main () {
62 int z=3;
65 foo::foo (int i) { ifoo = i;}
66 foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
67 foo::foo (foo& afoo) { afoo.ifoo = 0; }
68 foo::~foo () {}
70 void foo::operator * (foo& afoo) { afoo.ifoo = 0; }
71 void foo::operator % (foo& afoo) { afoo.ifoo = 0; }
72 void foo::operator - (foo& afoo) { afoo.ifoo = 0; }
73 void foo::operator >> (foo& afoo) { afoo.ifoo = 0; }
74 void foo::operator != (foo& afoo) { afoo.ifoo = 0; }
75 void foo::operator > (foo& afoo) { afoo.ifoo = 0; }
76 void foo::operator >= (foo& afoo) { afoo.ifoo = 0; }
77 void foo::operator | (foo& afoo) { afoo.ifoo = 0; }
78 void foo::operator && (foo& afoo) { afoo.ifoo = 0; }
79 void foo::operator ! (void) {}
80 void foo::operator ++ (int ival) { ival = 0; }
81 void foo::operator = (foo& afoo) { afoo.ifoo = 0; }
82 void foo::operator += (foo& afoo) { afoo.ifoo = 0; }
83 void foo::operator *= (foo& afoo) { afoo.ifoo = 0; }
84 void foo::operator %= (foo& afoo) { afoo.ifoo = 0; }
85 void foo::operator >>= (foo& afoo) { afoo.ifoo = 0; }
86 void foo::operator |= (foo& afoo) { afoo.ifoo = 0; }
87 void foo::operator , (foo& afoo) { afoo.ifoo = 0; }
88 void foo::operator / (foo& afoo) { afoo.ifoo = 0; }
89 void foo::operator + (foo& afoo) { afoo.ifoo = 0; }
90 void foo::operator << (foo& afoo) { afoo.ifoo = 0; }
91 void foo::operator == (foo& afoo) { afoo.ifoo = 0; }
92 void foo::operator < (foo& afoo) { afoo.ifoo = 0; }
93 void foo::operator <= (foo& afoo) { afoo.ifoo = 0; }
94 void foo::operator & (foo& afoo) { afoo.ifoo = 0; }
95 void foo::operator ^ (foo& afoo) { afoo.ifoo = 0; }
96 void foo::operator || (foo& afoo) { afoo.ifoo = 0; }
97 void foo::operator ~ (void) {}
98 void foo::operator -- (int ival) { ival = 0; }
99 foo* foo::operator -> (void) {return this;}
100 void foo::operator -= (foo& afoo) { afoo.ifoo = 0; }
101 void foo::operator /= (foo& afoo) { afoo.ifoo = 0; }
102 void foo::operator <<= (foo& afoo) { afoo.ifoo = 0; }
103 void foo::operator &= (foo& afoo) { afoo.ifoo = 0; }
104 void foo::operator ^= (foo& afoo) { afoo.ifoo = 0; }
105 void foo::operator ->* (foo& afoo) { afoo.ifoo = 0; }
106 void foo::operator [] (foo& afoo) { afoo.ifoo = 0; }
107 void foo::operator () (foo& afoo) { afoo.ifoo = 0; }
108 void* foo::operator new (size_t ival) throw () { ival = 0; return 0; }
109 void* foo::operator new[] (size_t ival) throw () { ival = 0; return 0; }
110 void foo::operator delete (void *ptr) { ptr = 0; }
111 void foo::operator delete[] (void *ptr) { ptr = 0; }
112 /**/ foo::operator int () { return 0; }
113 /**/ foo::operator char* () { return 0; }
115 /* Some functions to test overloading by varying one argument type. */
117 void overload1arg (void) { }
118 void overload1arg (char arg) { arg = 0; }
119 void overload1arg (signed char arg) { arg = 0; }
120 void overload1arg (unsigned char arg) { arg = 0; }
121 void overload1arg (short arg) { arg = 0; }
122 void overload1arg (unsigned short arg) { arg = 0; }
123 void overload1arg (int arg) { arg = 0; }
124 void overload1arg (unsigned int arg) { arg = 0; }
125 void overload1arg (long arg) { arg = 0; }
126 void overload1arg (unsigned long arg) { arg = 0; }
127 void overload1arg (float arg) { arg = 0; }
128 void overload1arg (double arg) { arg = 0; }
130 /* Some functions to test overloading by varying argument count. */
132 void overloadargs (int a1) { a1 = 0; }
133 void overloadargs (int a1, int a2) { a1 = a2 = 0; }
134 void overloadargs (int a1, int a2, int a3) { a1 = a2 = a3 = 0; }
135 void overloadargs (int a1, int a2, int a3, int a4)
136 { a1 = a2 = a3 = a4 = 0; }
137 void overloadargs (int a1, int a2, int a3, int a4, int a5)
138 { a1 = a2 = a3 = a4 = a5 = 0; }
139 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6)
140 { a1 = a2 = a3 = a4 = a5 = a6 = 0; }
141 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7)
142 { a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; }
143 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
144 int a8)
145 { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; }
146 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
147 int a8, int a9)
148 { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; }
149 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
150 int a8, int a9, int a10)
151 { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
152 a10 = 0; }
153 void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
154 int a8, int a9, int a10, int a11)
155 { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
156 a10 = a11 == 0; }
158 /* Some hairy function definitions.
159 Use typedefs to help maintain sanity. */
161 typedef int (*PFPc_i)(char *);
162 typedef short (*PFPl_s)(long *);
163 typedef short (*PFPc_s)(char *);
164 typedef int (*PFl_i)(long);
165 typedef PFl_i (*PFPc_PFl_i)(char *);
166 typedef PFl_i (*PFPi_PFl_i)(int *);
167 typedef PFl_i (*PFPFPc_i_PFl_i)(PFPc_i);
168 typedef PFl_i (*PFs_PFl_i)(short);
169 typedef int (*PFPFPl_s_i)(PFPl_s);
170 typedef int (*PFPFPc_s_i)(PFPc_s);
172 PFs_PFl_i hairyfunc1 (int arg) { arg = 0; return 0; }
173 int hairyfunc2 (PFPc_i arg) { arg = 0; return 0; }
174 int hairyfunc3 (PFPFPl_s_i arg) { arg = 0; return 0; }
175 int hairyfunc4 (PFPFPc_s_i arg) { arg = 0; return 0; }
176 int hairyfunc5 (PFPc_PFl_i arg) { arg = 0; return 0; }
177 int hairyfunc6 (PFPi_PFl_i arg) { arg = 0; return 0; }
178 int hairyfunc7 (PFPFPc_i_PFl_i arg) { arg = 0; return 0; }
180 /* gdb has two demanglers (one for g++ 2.95, one for g++ 3).
181 These marker functions help me figure out which demangler is in use. */
183 char * dm_type_char_star (char * p) { return p; }
184 int dm_type_foo_ref (foo & foo) { return foo.ifoo; }
185 int * dm_type_int_star (int * p) { return p; }
186 long * dm_type_long_star (long * p) { return p; }
187 int dm_type_short (short i) { return i; }
188 int dm_type_long (long i) { return i; }
189 int dm_type_unsigned_int (unsigned int i) { return i; }
190 int dm_type_unsigned_short (unsigned short i) { return i; }
191 int dm_type_unsigned_long (unsigned long i) { return i; }
192 int dm_type_void (void) { return 0; }
193 void * dm_type_void_star (void * p) { return p; }
194 typedef int myint;
195 int dm_type_typedef (myint i) { return i; }