[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3)
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / ctf-cvexpr.exp
CommitLineData
30d1f018
WP
1# Copyright (C) 2019 Free Software Foundation, Inc.
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
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# This file is a subset of cvexpr.exp written by
17# Michael Snyder, Red Hat, Inc., 9/20/2001
18
19# This file is part of the gdb testsuite
20# Tests for type expressions using const and volatile keywords.
21
22#
23# test running programs
24#
25# -gt generates full-fledged CTF.
26
27standard_testfile cvexpr.c
28set opts "additional_flags=-gt"
29
30if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
31 untested "failed to compile"
32 return -1
33}
34
35clean_restart ${binfile}
36
37gdb_test_no_output "set print sevenbit-strings"
38gdb_test_no_output "set print address off"
39gdb_test_no_output "set width 0"
40
41set ws "\[ \t\]*"
42
43#
44# Test casting a scalar to const
45#
46
47gdb_test "whatis (const char) v_char" \
48 "type = const char" \
49 "(const char)"
50gdb_test "whatis (const signed char) v_signed_char" \
51 "type = const signed char" \
52 "(const signed char)"
53gdb_test "whatis (const unsigned char) v_unsigned_char" \
54 "type = const (unsigned char|char)" \
55 "(const unsigned char)"
56gdb_test "whatis (const short) v_short" \
57 "type = const (short|short int)" \
58 "(const short)"
59gdb_test "whatis (const signed short) v_signed_short" \
60 "type = const (short|short int|signed short|signed short int)" \
61 "(const signed short)"
62gdb_test "whatis (const unsigned short) v_unsigned_short" \
63 "type = const (unsigned short|short unsigned int)" \
64 "(const unsigned short)"
65gdb_test "whatis (const int) v_int" \
66 "type = const int" \
67 "(const int)"
68gdb_test "whatis (const signed int) v_signed_int" \
69 "type = const (signed int|int)" \
70 "(const signed int)"
71gdb_test "whatis (const unsigned int) v_unsigned_int" \
72 "type = const unsigned int" \
73 "(const unsigned int)"
74gdb_test "whatis (const long) v_long" \
75 "type = const (long|long int)" \
76 "(const long)"
77gdb_test "whatis (const signed long) v_signed_long" \
78 "type = const (signed |)long( int|)" \
79 "(const signed long)"
80gdb_test "whatis (const unsigned long) v_unsigned_long" \
81 "type = const (unsigned long|long unsigned int)" \
82 "(const unsigned long)"
83gdb_test "whatis (const long long) v_long_long" \
84 "type = const long long( int|)" \
85 "(const long long)"
86gdb_test "whatis (const signed long long) v_signed_long_long" \
87 "type = const (signed |)long long( int|)" \
88 "(const signed long long)"
89gdb_test "whatis (const unsigned long long) v_unsigned_long_long" \
90 "type = const (unsigned long long|long long unsigned int)" \
91 "(const unsigned long long)"
92gdb_test "whatis (const float) v_float" \
93 "type = const float" \
94 "(const float)"
95gdb_test "whatis (const double) v_double" \
96 "type = const double" \
97 "(const double)"
98
99#
100# Test casting a scalar to volatile
101#
102
103gdb_test "whatis (volatile char) v_char" \
104 "type = volatile char" \
105 "(volatile char)"
106gdb_test "whatis (volatile signed char) v_signed_char" \
107 "type = volatile signed char" \
108 "(volatile signed char)"
109gdb_test "whatis (volatile unsigned char) v_unsigned_char" \
110 "type = volatile (unsigned char|char)" \
111 "(volatile unsigned char)"
112gdb_test "whatis (volatile short) v_short" \
113 "type = volatile (short|short int)" \
114 "(volatile short)"
115gdb_test "whatis (volatile signed short) v_signed_short" \
116 "type = volatile (short|short int|signed short|signed short int)" \
117 "(volatile signed short)"
118gdb_test "whatis (volatile unsigned short) v_unsigned_short" \
119 "type = volatile (unsigned short|short unsigned int)" \
120 "(volatile unsigned short)"
121gdb_test "whatis (volatile int) v_int" \
122 "type = volatile int" \
123 "(volatile int)"
124gdb_test "whatis (volatile signed int) v_signed_int" \
125 "type = volatile (signed int|int)" \
126 "(volatile signed int)"
127gdb_test "whatis (volatile unsigned int) v_unsigned_int" \
128 "type = volatile unsigned int" \
129 "(volatile unsigned int)"
130gdb_test "whatis (volatile long) v_long" \
131 "type = volatile (long|long int)" \
132 "(volatile long)"
133gdb_test "whatis (volatile signed long) v_signed_long" \
134 "type = volatile (signed |)long( int|)" \
135 "(volatile signed long)"
136gdb_test "whatis (volatile unsigned long) v_unsigned_long" \
137 "type = volatile (unsigned long|long unsigned int)" \
138 "(volatile unsigned long)"
139gdb_test "whatis (volatile long long) v_long_long" \
140 "type = volatile long long( int|)" \
141 "(volatile long long)"
142gdb_test "whatis (volatile signed long long) v_signed_long_long" \
143 "type = volatile (signed |)long long( int|)" \
144 "(volatile signed long long)"
145gdb_test "whatis (volatile unsigned long long) v_unsigned_long_long" \
146 "type = volatile (unsigned long long|long long unsigned int)" \
147 "(volatile unsigned long long)"
148gdb_test "whatis (volatile float) v_float" \
149 "type = volatile float" \
150 "(volatile float)"
151gdb_test "whatis (volatile double) v_double" \
152 "type = volatile double" \
153 "(volatile double)"
154
155#
156# Combine const and volatile
157#
158
159gdb_test "whatis (const volatile int) v_int" \
160 "type = const volatile int" \
161 "(const volatile int)"
162gdb_test "whatis (volatile const int) v_int" \
163 "type = const volatile int" \
164 "(volatile const int)"
165gdb_test "whatis (const int volatile) v_int" \
166 "type = const volatile int" \
167 "(const int volatile)"
168gdb_test "whatis (volatile int const) v_int" \
169 "type = const volatile int" \
170 "(volatile int const)"
171gdb_test "whatis (int const volatile) v_int" \
172 "type = const volatile int" \
173 "(int const volatile)"
174gdb_test "whatis (int volatile const) v_int" \
175 "type = const volatile int" \
176 "(int volatile const)"
177
178gdb_test "whatis (const volatile int *) v_int_pointer" \
179 "type = const volatile int${ws}\\*" \
180 "(const volatile int *)"
181gdb_test "whatis (volatile const int *) v_int_pointer" \
182 "type = const volatile int${ws}\\*" \
183 "(volatile const int *)"
184gdb_test "whatis (const int volatile *) v_int_pointer" \
185 "type = const volatile int${ws}\\*" \
186 "(const int volatile)"
187gdb_test "whatis (volatile int const *) v_int_pointer" \
188 "type = const volatile int${ws}\\*" \
189 "(volatile int const *)"
190gdb_test "whatis (int const volatile *) v_int_pointer" \
191 "type = const volatile int${ws}\\*" \
192 "(int const volatile *)"
193gdb_test "whatis (int volatile const *) v_int_pointer" \
194 "type = const volatile int${ws}\\*" \
195 "(int volatile const *)"
196gdb_test "whatis (int * const volatile) v_int_pointer" \
197 "type = int${ws}\\*${ws}const volatile" \
198 "(int * const volatile)"
199gdb_test "whatis (int * volatile const) v_int_pointer" \
200 "type = int${ws}\\*${ws}const volatile" \
201 "(int * volatile const)"
202
203
204#
205# Put 'signed' and 'unsigned' before const/volatile (FIXME)
206#
207
208#gdb_test "whatis (signed const char) v_signed_char" \
209# "type = const char" \
210# "(signed const char)"
211#gdb_test "whatis (unsigned const char) v_unsigned_char" \
212# "type = const (unsigned char|char)" \
213# "(unsigned const char)"
214#gdb_test "whatis (signed const short) v_signed_short" \
215# "type = const (short|short int|signed short|signed short int)" \
216# "(signed const short)"
217#gdb_test "whatis (unsigned const short) v_unsigned_short" \
218# "type = const (unsigned short|short unsigned int)" \
219# "(unsigned const short)"
220#gdb_test "whatis (signed const int) v_signed_int" \
221# "type = const (signed int|int)" \
222# "(signed const int)"
223#gdb_test "whatis (unsigned const int) v_unsigned_int" \
224# "type = const unsigned int" \
225# "(unsigned const int)"
226#gdb_test "whatis (signed const long) v_signed_long" \
227# "type = const (signed |)long( int|)" \
228# "(signed const long)"
229#gdb_test "whatis (unsigned const long) v_unsigned_long" \
230# "type = const (unsigned long|long unsigned int)" \
231# "(unsigned const long)"
232#gdb_test "whatis (signed const long long) v_signed_long_long" \
233# "type = const (signed |)long long( int|)" \
234# "(signed const long long)"
235#gdb_test "whatis (unsigned const long long) v_unsigned_long_long" \
236# "type = const (unsigned long long|long long unsigned int)" \
237# "(const unsigned long long)"
238
239#gdb_test "whatis (signed volatile char) v_signed_char" \
240# "type = volatile char" \
241# "(signed volatile char)"
242#gdb_test "whatis (unsigned volatile char) v_unsigned_char" \
243# "type = volatile (unsigned char|char)" \
244# "(unsigned volatile char)"
245#gdb_test "whatis (signed volatile short) v_signed_short" \
246# "type = volatile (short|short int|signed short|signed short int)" \
247# "(signed volatile short)"
248#gdb_test "whatis (unsigned volatile short) v_unsigned_short" \
249# "type = volatile (unsigned short|short unsigned int)" \
250# "(unsigned volatile short)"
251#gdb_test "whatis (signed volatile int) v_signed_int" \
252# "type = volatile (signed int|int)" \
253# "(signed volatile int)"
254#gdb_test "whatis (unsigned volatile int) v_unsigned_int" \
255# "type = volatile unsigned int" \
256# "(unsigned volatile int)"
257#gdb_test "whatis (signed volatile long) v_signed_long" \
258# "type = volatile (signed |)long( int|)" \
259# "(signed volatile long)"
260#gdb_test "whatis (unsigned volatile long) v_unsigned_long" \
261# "type = volatile (unsigned long|long unsigned int)" \
262# "(unsigned volatile long)"
263#gdb_test "whatis (signed volatile long long) v_signed_long_long" \
264# "type = volatile (signed |)long long( int|)" \
265# "(signed volatile long long)"
266#gdb_test "whatis (unsigned volatile long long) v_unsigned_long_long" \
267# "type = volatile (unsigned long long|long long unsigned int)" \
268# "(unsigned volatile long long)"
269
270#
271# Now put the 'const' and 'volatile' keywords after the base type.
272#
273
274gdb_test "whatis (char const) v_char" \
275 "type = const char" \
276 "(char const)"
277gdb_test "whatis (signed char const) v_signed_char" \
278 "type = const signed char" \
279 "(signed char const)"
280gdb_test "whatis (unsigned char const) v_unsigned_char" \
281 "type = const (unsigned char|char)" \
282 "(unsigned char const)"
283gdb_test "whatis (short const) v_short" \
284 "type = const (short|short int)" \
285 "(short const)"
286gdb_test "whatis (signed short const) v_signed_short" \
287 "type = const (short|short int|signed short|signed short int)" \
288 "(signed short const)"
289gdb_test "whatis (unsigned short const) v_unsigned_short" \
290 "type = const (unsigned short|short unsigned int)" \
291 "(unsigned short const)"
292gdb_test "whatis (int const) v_int" \
293 "type = const int" \
294 "(int const)"
295gdb_test "whatis (signed int const) v_signed_int" \
296 "type = const (signed int|int)" \
297 "(signed int const)"
298gdb_test "whatis (unsigned int const) v_unsigned_int" \
299 "type = const unsigned int" \
300 "(unsigned int const)"
301gdb_test "whatis (long const) v_long" \
302 "type = const (long|long int)" \
303 "(long const)"
304gdb_test "whatis (signed long const) v_signed_long" \
305 "type = const (signed |)long( int|)" \
306 "(signed long const)"
307gdb_test "whatis (unsigned long const) v_unsigned_long" \
308 "type = const (unsigned long|long unsigned int)" \
309 "(unsigned long const)"
310gdb_test "whatis (long long const) v_long_long" \
311 "type = const long long( int|)" \
312 "(long long const)"
313gdb_test "whatis (signed long long const) v_signed_long_long" \
314 "type = const (signed |)long long( int|)" \
315 "(signed long long const)"
316gdb_test "whatis (unsigned long long const) v_unsigned_long_long" \
317 "type = const (unsigned long long|long long unsigned int)" \
318 "(unsigned long long const)"
319gdb_test "whatis (float const) v_float" \
320 "type = const float" \
321 "(float const)"
322gdb_test "whatis (double const) v_double" \
323 "type = const double" \
324 "(double const)"
325
326gdb_test "whatis (char volatile) v_char" \
327 "type = volatile char" \
328 "(char volatile)"
329gdb_test "whatis (signed char volatile) v_signed_char" \
330 "type = volatile signed char" \
331 "(signed char volatile)"
332gdb_test "whatis (unsigned char volatile) v_unsigned_char" \
333 "type = volatile (unsigned char|char)" \
334 "(unsigned char volatile)"
335gdb_test "whatis (short volatile) v_short" \
336 "type = volatile (short|short int)" \
337 "(short volatile)"
338gdb_test "whatis (signed short volatile) v_signed_short" \
339 "type = volatile (short|short int|signed short|signed short int)" \
340 "(signed short volatile)"
341gdb_test "whatis (unsigned short volatile) v_unsigned_short" \
342 "type = volatile (unsigned short|short unsigned int)" \
343 "(unsigned short volatile)"
344gdb_test "whatis (int volatile) v_int" \
345 "type = volatile int" \
346 "(int volatile)"
347gdb_test "whatis (signed int volatile) v_signed_int" \
348 "type = volatile (signed int|int)" \
349 "(signed int volatile)"
350gdb_test "whatis (unsigned int volatile) v_unsigned_int" \
351 "type = volatile unsigned int" \
352 "(unsigned int volatile)"
353gdb_test "whatis (long volatile) v_long" \
354 "type = volatile (long|long int)" \
355 "(long volatile)"
356gdb_test "whatis (signed long volatile) v_signed_long" \
357 "type = volatile (signed |)long( int|)" \
358 "(signed long volatile)"
359gdb_test "whatis (unsigned long volatile) v_unsigned_long" \
360 "type = volatile (unsigned long|long unsigned int)" \
361 "(unsigned long volatile)"
362gdb_test "whatis (long long volatile) v_long_long" \
363 "type = volatile long long( int|)" \
364 "(long long volatile)"
365gdb_test "whatis (signed long long volatile) v_signed_long_long" \
366 "type = volatile (signed |)long long( int|)" \
367 "(signed long long volatile)"
368gdb_test "whatis (unsigned long long volatile) v_unsigned_long_long" \
369 "type = volatile (unsigned long long|long long unsigned int)" \
370 "(unsigned long long volatile)"
371gdb_test "whatis (float volatile) v_float" \
372 "type = volatile float" \
373 "(float volatile)"
374gdb_test "whatis (double volatile) v_double" \
375 "type = volatile double" \
376 "(double volatile)"
377
378#
379# enums
380#
381
382gdb_test "whatis (const enum misordered) v_misordered" \
383 "type = const enum misordered" \
384 "(const enum misordered)"
385gdb_test "whatis (enum misordered const) v_misordered" \
386 "type = const enum misordered" \
387 "(enum misordered const)"
388gdb_test "whatis (volatile enum misordered) v_misordered" \
389 "type = volatile enum misordered" \
390 "(volatile enum misordered)"
391gdb_test "whatis (enum misordered volatile) v_misordered" \
392 "type = volatile enum misordered" \
393 "(enum misordered volatile)"
394
395#
396# Pointers
397#
398
399gdb_test "whatis (const int *) v_int_pointer" \
400 "type = const int${ws}\\*" \
401 "(const int *)"
402gdb_test "whatis (int const *) v_int_pointer" \
403 "type = const int${ws}\\*" \
404 "(int const *)"
405gdb_test "whatis (int * const) v_int_pointer" \
406 "type = int \\*${ws}const" \
407 "(int * const)"
408gdb_test "whatis (const int * const) v_int_pointer" \
409 "type = const int${ws}\\*${ws}const" \
410 "(const int * const)"
411gdb_test "whatis (int const * const) v_int_pointer" \
412 "type = const int${ws}\\*${ws}const" \
413 "(int const * const)"
414
415gdb_test "whatis (const int **) v_int_pointer_pointer" \
416 "type = const int${ws}\\*${ws}\\*" \
417 "(const int **)"
418gdb_test "whatis (int const **) v_int_pointer_pointer" \
419 "type = const int${ws}\\*${ws}\\*" \
420 "(int const **)"
421gdb_test "whatis (int ** const) v_int_pointer_pointer" \
422 "type = int \\*${ws}\\*${ws}const" \
423 "(int ** const)"
424gdb_test "whatis (const int * const *) v_int_pointer_pointer" \
425 "type = const int${ws}\\*${ws}const${ws}\\*" \
426 "(const int * const *)"
427gdb_test "whatis (int const * const *) v_int_pointer_pointer" \
428 "type = const int${ws}\\*${ws}const${ws}\\*" \
429 "(int const * const *)"
430gdb_test "whatis (const int * const * const) v_int_pointer_pointer" \
431 "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
432 "(const int * const * const)"
433gdb_test "whatis (int const * const * const) v_int_pointer_pointer" \
434 "type = const int${ws}\\*${ws}const${ws}\\*${ws}const" \
435 "(int const * const * const)"
436
437#
438# Arrays TODO
439#
440
441#
442# Pointers to arrays, arrays of pointers TODO
443#
444
445#
446# Structs and Unions
447#
448
449gdb_test "whatis (const struct t_struct) v_struct1" \
450 "type = const struct t_struct" \
451 "(const struct t_struct)"
452gdb_test "whatis (const union t_union) v_union" \
453 "type = const union t_union" \
454 "(const union t_union)"
455gdb_test "whatis (struct t_struct const) v_struct1" \
456 "type = const struct t_struct" \
457 "(struct t_struct const)"
458gdb_test "whatis (union t_union const) v_union" \
459 "type = const union t_union" \
460 "(union t_union const)"
461gdb_test "whatis (const struct t_struct *) &v_struct1" \
462 "type = const struct t_struct${ws}\\*" \
463 "(const struct t_struct *)"
464gdb_test "whatis (const union t_union *) &v_union" \
465 "type = const union t_union${ws}\\*" \
466 "(const union t_union *)"
467gdb_test "whatis (struct t_struct const *) &v_struct1" \
468 "type = const struct t_struct${ws}\\*" \
469 "(struct t_struct const *)"
470gdb_test "whatis (union t_union const *) &v_union" \
471 "type = const union t_union${ws}\\*" \
472 "(union t_union const *)"
473gdb_test "whatis (struct t_struct * const) &v_struct1" \
474 "type = struct t_struct${ws}\\*${ws}const" \
475 "(struct t_struct * const)"
476gdb_test "whatis (union t_union * const) &v_union" \
477 "type = union t_union${ws}\\*${ws}const" \
478 "(union t_union * const)"
479gdb_test "whatis (const struct t_struct * const) &v_struct1" \
480 "type = const struct t_struct${ws}\\*${ws}const" \
481 "(const struct t_struct * const)"
482gdb_test "whatis (const union t_union * const) &v_union" \
483 "type = const union t_union${ws}\\*${ws}const" \
484 "(const union t_union * const)"
485gdb_test "whatis (struct t_struct const * const) &v_struct1" \
486 "type = const struct t_struct${ws}\\*${ws}const" \
487 "(struct t_struct const * const)"
488gdb_test "whatis (union t_union const * const) &v_union" \
489 "type = const union t_union${ws}\\*${ws}const" \
490 "(union t_union const * const)"
491
492#
493# Function pointers TODO
494#
495
This page took 0.090168 seconds and 4 git commands to generate.