Add C parser support for "restrict" and "_Atomic"
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / cvexpr.exp
CommitLineData
b811d2c2 1# Copyright (C) 2001-2020 Free Software Foundation, Inc.
4749e309
MS
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
4749e309 6# (at your option) any later version.
e22f8b7c 7#
4749e309
MS
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
e22f8b7c 12#
4749e309 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
4749e309 15
4749e309
MS
16# Written by Michael Snyder, Red Hat, Inc., 9/20/2001
17
18# This file is part of the gdb testsuite
19# Tests for type expressions using const and volatile keywords.
20
f76495c8 21standard_testfile .c
4749e309 22
f833b7a7
AB
23# Compile the test using OPTIONS into a sub-directory DIR, and then
24# run the test.
25proc do_test {dir options} {
26 global srcfile testfile
4749e309 27
f833b7a7
AB
28 set binfile [standard_output_file ${dir}/${testfile}]
29 if { [prepare_for_testing "failed to prepare" ${binfile} \
30 [list $srcfile] $options] } {
31 return 0
32 }
4749e309 33
f833b7a7 34 clean_restart ${binfile}
4749e309 35
f833b7a7
AB
36 gdb_test_no_output "set print sevenbit-strings"
37 gdb_test_no_output "set print address off"
38 gdb_test_no_output "set width 0"
4749e309 39
f833b7a7
AB
40 set ws "\[ \t\]*"
41
42 #
43 # Test casting a scalar to const
44 #
4749e309 45
f833b7a7 46 gdb_test "whatis (const char) v_char" \
4749e309
MS
47 "type = const char" \
48 "(const char)"
f833b7a7 49 gdb_test "whatis (const signed char) v_signed_char" \
4749e309
MS
50 "type = const signed char" \
51 "(const signed char)"
f833b7a7 52 gdb_test "whatis (const unsigned char) v_unsigned_char" \
4749e309
MS
53 "type = const (unsigned char|char)" \
54 "(const unsigned char)"
f833b7a7 55 gdb_test "whatis (const short) v_short" \
4749e309
MS
56 "type = const (short|short int)" \
57 "(const short)"
f833b7a7 58 gdb_test "whatis (const signed short) v_signed_short" \
4749e309
MS
59 "type = const (short|short int|signed short|signed short int)" \
60 "(const signed short)"
f833b7a7 61 gdb_test "whatis (const unsigned short) v_unsigned_short" \
4749e309
MS
62 "type = const (unsigned short|short unsigned int)" \
63 "(const unsigned short)"
f833b7a7 64 gdb_test "whatis (const int) v_int" \
4749e309
MS
65 "type = const int" \
66 "(const int)"
f833b7a7 67 gdb_test "whatis (const signed int) v_signed_int" \
4749e309
MS
68 "type = const (signed int|int)" \
69 "(const signed int)"
f833b7a7 70 gdb_test "whatis (const unsigned int) v_unsigned_int" \
4749e309
MS
71 "type = const unsigned int" \
72 "(const unsigned int)"
f833b7a7 73 gdb_test "whatis (const long) v_long" \
4749e309
MS
74 "type = const (long|long int)" \
75 "(const long)"
f833b7a7 76 gdb_test "whatis (const signed long) v_signed_long" \
4749e309
MS
77 "type = const (signed |)long( int|)" \
78 "(const signed long)"
f833b7a7 79 gdb_test "whatis (const unsigned long) v_unsigned_long" \
4749e309
MS
80 "type = const (unsigned long|long unsigned int)" \
81 "(const unsigned long)"
f833b7a7 82 gdb_test "whatis (const long long) v_long_long" \
4749e309
MS
83 "type = const long long( int|)" \
84 "(const long long)"
f833b7a7 85 gdb_test "whatis (const signed long long) v_signed_long_long" \
4749e309
MS
86 "type = const (signed |)long long( int|)" \
87 "(const signed long long)"
f833b7a7 88 gdb_test "whatis (const unsigned long long) v_unsigned_long_long" \
4749e309
MS
89 "type = const (unsigned long long|long long unsigned int)" \
90 "(const unsigned long long)"
f833b7a7 91 gdb_test "whatis (const float) v_float" \
4749e309
MS
92 "type = const float" \
93 "(const float)"
f833b7a7 94 gdb_test "whatis (const double) v_double" \
4749e309
MS
95 "type = const double" \
96 "(const double)"
97
f833b7a7
AB
98 #
99 # Test casting a scalar to volatile
100 #
4749e309 101
f833b7a7 102 gdb_test "whatis (volatile char) v_char" \
4749e309
MS
103 "type = volatile char" \
104 "(volatile char)"
f833b7a7 105 gdb_test "whatis (volatile signed char) v_signed_char" \
4749e309
MS
106 "type = volatile signed char" \
107 "(volatile signed char)"
f833b7a7 108 gdb_test "whatis (volatile unsigned char) v_unsigned_char" \
4749e309
MS
109 "type = volatile (unsigned char|char)" \
110 "(volatile unsigned char)"
f833b7a7 111 gdb_test "whatis (volatile short) v_short" \
4749e309
MS
112 "type = volatile (short|short int)" \
113 "(volatile short)"
f833b7a7 114 gdb_test "whatis (volatile signed short) v_signed_short" \
4749e309
MS
115 "type = volatile (short|short int|signed short|signed short int)" \
116 "(volatile signed short)"
f833b7a7 117 gdb_test "whatis (volatile unsigned short) v_unsigned_short" \
4749e309
MS
118 "type = volatile (unsigned short|short unsigned int)" \
119 "(volatile unsigned short)"
f833b7a7 120 gdb_test "whatis (volatile int) v_int" \
4749e309
MS
121 "type = volatile int" \
122 "(volatile int)"
f833b7a7 123 gdb_test "whatis (volatile signed int) v_signed_int" \
4749e309
MS
124 "type = volatile (signed int|int)" \
125 "(volatile signed int)"
f833b7a7 126 gdb_test "whatis (volatile unsigned int) v_unsigned_int" \
4749e309
MS
127 "type = volatile unsigned int" \
128 "(volatile unsigned int)"
f833b7a7 129 gdb_test "whatis (volatile long) v_long" \
4749e309
MS
130 "type = volatile (long|long int)" \
131 "(volatile long)"
f833b7a7 132 gdb_test "whatis (volatile signed long) v_signed_long" \
4749e309
MS
133 "type = volatile (signed |)long( int|)" \
134 "(volatile signed long)"
f833b7a7 135 gdb_test "whatis (volatile unsigned long) v_unsigned_long" \
4749e309
MS
136 "type = volatile (unsigned long|long unsigned int)" \
137 "(volatile unsigned long)"
f833b7a7 138 gdb_test "whatis (volatile long long) v_long_long" \
4749e309
MS
139 "type = volatile long long( int|)" \
140 "(volatile long long)"
f833b7a7 141 gdb_test "whatis (volatile signed long long) v_signed_long_long" \
4749e309
MS
142 "type = volatile (signed |)long long( int|)" \
143 "(volatile signed long long)"
f833b7a7 144 gdb_test "whatis (volatile unsigned long long) v_unsigned_long_long" \
4749e309
MS
145 "type = volatile (unsigned long long|long long unsigned int)" \
146 "(volatile unsigned long long)"
f833b7a7 147 gdb_test "whatis (volatile float) v_float" \
4749e309
MS
148 "type = volatile float" \
149 "(volatile float)"
f833b7a7 150 gdb_test "whatis (volatile double) v_double" \
4749e309
MS
151 "type = volatile double" \
152 "(volatile double)"
153
f833b7a7
AB
154 #
155 # Combine const and volatile
156 #
4749e309 157
f833b7a7 158 gdb_test "whatis (const volatile int) v_int" \
4749e309
MS
159 "type = const volatile int" \
160 "(const volatile int)"
f833b7a7 161 gdb_test "whatis (volatile const int) v_int" \
4749e309
MS
162 "type = const volatile int" \
163 "(volatile const int)"
f833b7a7 164 gdb_test "whatis (const int volatile) v_int" \
4749e309
MS
165 "type = const volatile int" \
166 "(const int volatile)"
f833b7a7 167 gdb_test "whatis (volatile int const) v_int" \
4749e309
MS
168 "type = const volatile int" \
169 "(volatile int const)"
f833b7a7 170 gdb_test "whatis (int const volatile) v_int" \
4749e309
MS
171 "type = const volatile int" \
172 "(int const volatile)"
f833b7a7 173 gdb_test "whatis (int volatile const) v_int" \
4749e309
MS
174 "type = const volatile int" \
175 "(int volatile const)"
176
f833b7a7 177 gdb_test "whatis (const volatile int *) v_int_pointer" \
4749e309
MS
178 "type = const volatile int${ws}\\*" \
179 "(const volatile int *)"
f833b7a7 180 gdb_test "whatis (volatile const int *) v_int_pointer" \
4749e309
MS
181 "type = const volatile int${ws}\\*" \
182 "(volatile const int *)"
f833b7a7 183 gdb_test "whatis (const int volatile *) v_int_pointer" \
4749e309 184 "type = const volatile int${ws}\\*" \
f833b7a7
AB
185 "(const int volatile *)"
186 gdb_test "whatis (volatile int const *) v_int_pointer" \
4749e309
MS
187 "type = const volatile int${ws}\\*" \
188 "(volatile int const *)"
f833b7a7 189 gdb_test "whatis (int const volatile *) v_int_pointer" \
4749e309
MS
190 "type = const volatile int${ws}\\*" \
191 "(int const volatile *)"
f833b7a7 192 gdb_test "whatis (int volatile const *) v_int_pointer" \
4749e309
MS
193 "type = const volatile int${ws}\\*" \
194 "(int volatile const *)"
f833b7a7 195 gdb_test "whatis (int * const volatile) v_int_pointer" \
4749e309
MS
196 "type = int${ws}\\*${ws}const volatile" \
197 "(int * const volatile)"
f833b7a7 198 gdb_test "whatis (int * volatile const) v_int_pointer" \
4749e309
MS
199 "type = int${ws}\\*${ws}const volatile" \
200 "(int * volatile const)"
201
202
f833b7a7
AB
203 #
204 # Put 'signed' and 'unsigned' before const/volatile
205 #
206
207 #gdb_test "whatis (signed const char) v_signed_char" \
208 # "type = const char" \
209 # "(signed const char)"
210 #gdb_test "whatis (unsigned const char) v_unsigned_char" \
211 # "type = const (unsigned char|char)" \
212 # "(unsigned const char)"
213 #gdb_test "whatis (signed const short) v_signed_short" \
214 # "type = const (short|short int|signed short|signed short int)" \
215 # "(signed const short)"
216 #gdb_test "whatis (unsigned const short) v_unsigned_short" \
217 # "type = const (unsigned short|short unsigned int)" \
218 # "(unsigned const short)"
219 #gdb_test "whatis (signed const int) v_signed_int" \
220 # "type = const (signed int|int)" \
221 # "(signed const int)"
222 #gdb_test "whatis (unsigned const int) v_unsigned_int" \
223 # "type = const unsigned int" \
224 # "(unsigned const int)"
225 #gdb_test "whatis (signed const long) v_signed_long" \
226 # "type = const (signed |)long( int|)" \
227 # "(signed const long)"
228 #gdb_test "whatis (unsigned const long) v_unsigned_long" \
229 # "type = const (unsigned long|long unsigned int)" \
230 # "(unsigned const long)"
231 #gdb_test "whatis (signed const long long) v_signed_long_long" \
232 # "type = const (signed |)long long( int|)" \
233 # "(signed const long long)"
234 #gdb_test "whatis (unsigned const long long) v_unsigned_long_long" \
235 # "type = const (unsigned long long|long long unsigned int)" \
236 # "(const unsigned long long)"
237
238 #gdb_test "whatis (signed volatile char) v_signed_char" \
239 # "type = volatile char" \
240 # "(signed volatile char)"
241 #gdb_test "whatis (unsigned volatile char) v_unsigned_char" \
242 # "type = volatile (unsigned char|char)" \
243 # "(unsigned volatile char)"
244 #gdb_test "whatis (signed volatile short) v_signed_short" \
245 # "type = volatile (short|short int|signed short|signed short int)" \
246 # "(signed volatile short)"
247 #gdb_test "whatis (unsigned volatile short) v_unsigned_short" \
248 # "type = volatile (unsigned short|short unsigned int)" \
249 # "(unsigned volatile short)"
250 #gdb_test "whatis (signed volatile int) v_signed_int" \
251 # "type = volatile (signed int|int)" \
252 # "(signed volatile int)"
253 #gdb_test "whatis (unsigned volatile int) v_unsigned_int" \
254 # "type = volatile unsigned int" \
255 # "(unsigned volatile int)"
256 #gdb_test "whatis (signed volatile long) v_signed_long" \
257 # "type = volatile (signed |)long( int|)" \
258 # "(signed volatile long)"
259 #gdb_test "whatis (unsigned volatile long) v_unsigned_long" \
260 # "type = volatile (unsigned long|long unsigned int)" \
261 # "(unsigned volatile long)"
262 #gdb_test "whatis (signed volatile long long) v_signed_long_long" \
263 # "type = volatile (signed |)long long( int|)" \
264 # "(signed volatile long long)"
265 #gdb_test "whatis (unsigned volatile long long) v_unsigned_long_long" \
266 # "type = volatile (unsigned long long|long long unsigned int)" \
267 # "(unsigned volatile long long)"
268
269 #
270 # Now put the 'const' and 'volatile' keywords after the base type.
271 #
272
273 gdb_test "whatis (char const) v_char" \
4749e309
MS
274 "type = const char" \
275 "(char const)"
f833b7a7 276 gdb_test "whatis (signed char const) v_signed_char" \
4749e309
MS
277 "type = const signed char" \
278 "(signed char const)"
f833b7a7 279 gdb_test "whatis (unsigned char const) v_unsigned_char" \
4749e309
MS
280 "type = const (unsigned char|char)" \
281 "(unsigned char const)"
f833b7a7 282 gdb_test "whatis (short const) v_short" \
4749e309
MS
283 "type = const (short|short int)" \
284 "(short const)"
f833b7a7 285 gdb_test "whatis (signed short const) v_signed_short" \
4749e309
MS
286 "type = const (short|short int|signed short|signed short int)" \
287 "(signed short const)"
f833b7a7 288 gdb_test "whatis (unsigned short const) v_unsigned_short" \
4749e309
MS
289 "type = const (unsigned short|short unsigned int)" \
290 "(unsigned short const)"
f833b7a7 291 gdb_test "whatis (int const) v_int" \
4749e309
MS
292 "type = const int" \
293 "(int const)"
f833b7a7 294 gdb_test "whatis (signed int const) v_signed_int" \
4749e309
MS
295 "type = const (signed int|int)" \
296 "(signed int const)"
f833b7a7 297 gdb_test "whatis (unsigned int const) v_unsigned_int" \
4749e309
MS
298 "type = const unsigned int" \
299 "(unsigned int const)"
f833b7a7 300 gdb_test "whatis (long const) v_long" \
4749e309
MS
301 "type = const (long|long int)" \
302 "(long const)"
f833b7a7 303 gdb_test "whatis (signed long const) v_signed_long" \
4749e309
MS
304 "type = const (signed |)long( int|)" \
305 "(signed long const)"
f833b7a7 306 gdb_test "whatis (unsigned long const) v_unsigned_long" \
4749e309
MS
307 "type = const (unsigned long|long unsigned int)" \
308 "(unsigned long const)"
f833b7a7 309 gdb_test "whatis (long long const) v_long_long" \
4749e309
MS
310 "type = const long long( int|)" \
311 "(long long const)"
f833b7a7 312 gdb_test "whatis (signed long long const) v_signed_long_long" \
4749e309
MS
313 "type = const (signed |)long long( int|)" \
314 "(signed long long const)"
f833b7a7 315 gdb_test "whatis (unsigned long long const) v_unsigned_long_long" \
4749e309
MS
316 "type = const (unsigned long long|long long unsigned int)" \
317 "(unsigned long long const)"
f833b7a7 318 gdb_test "whatis (float const) v_float" \
4749e309
MS
319 "type = const float" \
320 "(float const)"
f833b7a7 321 gdb_test "whatis (double const) v_double" \
4749e309
MS
322 "type = const double" \
323 "(double const)"
324
f833b7a7 325 gdb_test "whatis (char volatile) v_char" \
4749e309
MS
326 "type = volatile char" \
327 "(char volatile)"
f833b7a7 328 gdb_test "whatis (signed char volatile) v_signed_char" \
4749e309
MS
329 "type = volatile signed char" \
330 "(signed char volatile)"
f833b7a7 331 gdb_test "whatis (unsigned char volatile) v_unsigned_char" \
4749e309
MS
332 "type = volatile (unsigned char|char)" \
333 "(unsigned char volatile)"
f833b7a7 334 gdb_test "whatis (short volatile) v_short" \
4749e309
MS
335 "type = volatile (short|short int)" \
336 "(short volatile)"
f833b7a7 337 gdb_test "whatis (signed short volatile) v_signed_short" \
4749e309
MS
338 "type = volatile (short|short int|signed short|signed short int)" \
339 "(signed short volatile)"
f833b7a7 340 gdb_test "whatis (unsigned short volatile) v_unsigned_short" \
4749e309
MS
341 "type = volatile (unsigned short|short unsigned int)" \
342 "(unsigned short volatile)"
f833b7a7 343 gdb_test "whatis (int volatile) v_int" \
4749e309
MS
344 "type = volatile int" \
345 "(int volatile)"
f833b7a7 346 gdb_test "whatis (signed int volatile) v_signed_int" \
4749e309
MS
347 "type = volatile (signed int|int)" \
348 "(signed int volatile)"
f833b7a7 349 gdb_test "whatis (unsigned int volatile) v_unsigned_int" \
4749e309
MS
350 "type = volatile unsigned int" \
351 "(unsigned int volatile)"
f833b7a7 352 gdb_test "whatis (long volatile) v_long" \
4749e309
MS
353 "type = volatile (long|long int)" \
354 "(long volatile)"
f833b7a7 355 gdb_test "whatis (signed long volatile) v_signed_long" \
4749e309
MS
356 "type = volatile (signed |)long( int|)" \
357 "(signed long volatile)"
f833b7a7 358 gdb_test "whatis (unsigned long volatile) v_unsigned_long" \
4749e309
MS
359 "type = volatile (unsigned long|long unsigned int)" \
360 "(unsigned long volatile)"
f833b7a7 361 gdb_test "whatis (long long volatile) v_long_long" \
4749e309
MS
362 "type = volatile long long( int|)" \
363 "(long long volatile)"
f833b7a7 364 gdb_test "whatis (signed long long volatile) v_signed_long_long" \
4749e309
MS
365 "type = volatile (signed |)long long( int|)" \
366 "(signed long long volatile)"
f833b7a7 367 gdb_test "whatis (unsigned long long volatile) v_unsigned_long_long" \
4749e309
MS
368 "type = volatile (unsigned long long|long long unsigned int)" \
369 "(unsigned long long volatile)"
f833b7a7 370 gdb_test "whatis (float volatile) v_float" \
4749e309
MS
371 "type = volatile float" \
372 "(float volatile)"
f833b7a7 373 gdb_test "whatis (double volatile) v_double" \
4749e309
MS
374 "type = volatile double" \
375 "(double volatile)"
376
f833b7a7
AB
377 #
378 # enums
379 #
4749e309 380
f833b7a7 381 gdb_test "whatis (const enum misordered) v_misordered" \
4749e309
MS
382 "type = const enum misordered" \
383 "(const enum misordered)"
f833b7a7 384 gdb_test "whatis (enum misordered const) v_misordered" \
4749e309
MS
385 "type = const enum misordered" \
386 "(enum misordered const)"
f833b7a7 387 gdb_test "whatis (volatile enum misordered) v_misordered" \
4749e309
MS
388 "type = volatile enum misordered" \
389 "(volatile enum misordered)"
f833b7a7 390 gdb_test "whatis (enum misordered volatile) v_misordered" \
4749e309
MS
391 "type = volatile enum misordered" \
392 "(enum misordered volatile)"
393
f833b7a7
AB
394 #
395 # Pointers
396 #
4749e309 397
f833b7a7 398 gdb_test "whatis (const int *) v_int_pointer" \
4749e309
MS
399 "type = const int${ws}\\*" \
400 "(const int *)"
f833b7a7 401 gdb_test "whatis (int const *) v_int_pointer" \
4749e309
MS
402 "type = const int${ws}\\*" \
403 "(int const *)"
f833b7a7 404 gdb_test "whatis (int * const) v_int_pointer" \
4749e309
MS
405 "type = int \\*${ws}const" \
406 "(int * const)"
f833b7a7 407 gdb_test "whatis (const int * const) v_int_pointer" \
4749e309
MS
408 "type = const int${ws}\\*${ws}const" \
409 "(const int * const)"
f833b7a7 410 gdb_test "whatis (int const * const) v_int_pointer" \
4749e309
MS
411 "type = const int${ws}\\*${ws}const" \
412 "(int const * const)"
413
f833b7a7 414 gdb_test "whatis (const int **) v_int_pointer_pointer" \
4749e309
MS
415 "type = const int${ws}\\*${ws}\\*" \
416 "(const int **)"
f833b7a7 417 gdb_test "whatis (int const **) v_int_pointer_pointer" \
4749e309
MS
418 "type = const int${ws}\\*${ws}\\*" \
419 "(int const **)"
f833b7a7 420 gdb_test "whatis (int ** const) v_int_pointer_pointer" \
4749e309
MS
421 "type = int \\*${ws}\\*${ws}const" \
422 "(int ** const)"
f833b7a7 423 gdb_test "whatis (const int * const *) v_int_pointer_pointer" \
4749e309
MS
424 "type = const int${ws}\\*${ws}const${ws}\\*" \
425 "(const int * const *)"
f833b7a7 426 gdb_test "whatis (int const * const *) v_int_pointer_pointer" \
4749e309
MS
427 "type = const int${ws}\\*${ws}const${ws}\\*" \
428 "(int const * const *)"
f833b7a7 429 gdb_test "whatis (const int * const * const) v_int_pointer_pointer" \
4749e309
MS
430 "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
431 "(const int * const * const)"
f833b7a7 432 gdb_test "whatis (int const * const * const) v_int_pointer_pointer" \
4749e309
MS
433 "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
434 "(int const * const * const)"
435
f833b7a7
AB
436 #
437 # Arrays TODO
438 #
4749e309 439
f833b7a7
AB
440 #
441 # Pointers to arrays, arrays of pointers TODO
442 #
4749e309 443
f833b7a7
AB
444 #
445 # Structs and Unions
446 #
4749e309 447
f833b7a7 448 gdb_test "whatis (const struct t_struct) v_struct1" \
4749e309
MS
449 "type = const struct t_struct" \
450 "(const struct t_struct)"
f833b7a7 451 gdb_test "whatis (const union t_union) v_union" \
4749e309
MS
452 "type = const union t_union" \
453 "(const union t_union)"
f833b7a7 454 gdb_test "whatis (struct t_struct const) v_struct1" \
4749e309
MS
455 "type = const struct t_struct" \
456 "(struct t_struct const)"
f833b7a7 457 gdb_test "whatis (union t_union const) v_union" \
4749e309
MS
458 "type = const union t_union" \
459 "(union t_union const)"
f833b7a7 460 gdb_test "whatis (const struct t_struct *) &v_struct1" \
4749e309
MS
461 "type = const struct t_struct${ws}\\*" \
462 "(const struct t_struct *)"
f833b7a7 463 gdb_test "whatis (const union t_union *) &v_union" \
4749e309
MS
464 "type = const union t_union${ws}\\*" \
465 "(const union t_union *)"
f833b7a7 466 gdb_test "whatis (struct t_struct const *) &v_struct1" \
4749e309
MS
467 "type = const struct t_struct${ws}\\*" \
468 "(struct t_struct const *)"
f833b7a7 469 gdb_test "whatis (union t_union const *) &v_union" \
4749e309
MS
470 "type = const union t_union${ws}\\*" \
471 "(union t_union const *)"
f833b7a7 472 gdb_test "whatis (struct t_struct * const) &v_struct1" \
4749e309
MS
473 "type = struct t_struct${ws}\\*${ws}const" \
474 "(struct t_struct * const)"
f833b7a7 475 gdb_test "whatis (union t_union * const) &v_union" \
4749e309
MS
476 "type = union t_union${ws}\\*${ws}const" \
477 "(union t_union * const)"
f833b7a7 478 gdb_test "whatis (const struct t_struct * const) &v_struct1" \
4749e309
MS
479 "type = const struct t_struct${ws}\\*${ws}const" \
480 "(const struct t_struct * const)"
f833b7a7 481 gdb_test "whatis (const union t_union * const) &v_union" \
4749e309
MS
482 "type = const union t_union${ws}\\*${ws}const" \
483 "(const union t_union * const)"
f833b7a7 484 gdb_test "whatis (struct t_struct const * const) &v_struct1" \
4749e309
MS
485 "type = const struct t_struct${ws}\\*${ws}const" \
486 "(struct t_struct const * const)"
f833b7a7 487 gdb_test "whatis (union t_union const * const) &v_union" \
4749e309
MS
488 "type = const union t_union${ws}\\*${ws}const" \
489 "(union t_union const * const)"
490
f833b7a7
AB
491 #
492 # Function pointers TODO
493 #
494}
4749e309 495
f833b7a7
AB
496# Build up the set of debug formats for which we will run this test.
497set specs { {dwarf {debug}} }
498if ![skip_ctf_tests] {
499 lappend specs {ctf {"additional_flags=-gt"}}
500}
501
502# Setup and run the test for each debug format.
503foreach testspec $specs {
504 set prefix [lindex $testspec 0]
505 set opts [lindex $testspec 1]
506
507 with_test_prefix $prefix {
508 remote_exec host "mkdir -p [standard_output_file ${prefix}]"
509 do_test $prefix $opts
510 }
511}
3293bbaf
TT
512
513# These tests don't rely on the debug format.
514gdb_test "ptype _Atomic int" "type = _Atomic int"
515gdb_test "ptype int * restrict" "type = int \\* restrict"
516
517# C++ does not have "restrict".
518gdb_test_no_output "set lang c++"
519gdb_test "ptype int * restrict" "A syntax error in expression.*"
520
521# There is a GCC extension for __restrict__, though.
522gdb_test "ptype int * __restrict__" "type = int \\* __restrict__"
This page took 1.965067 seconds and 4 git commands to generate.