]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/cpsizeof.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / cpsizeof.exp
CommitLineData
245a5f0b 1# sizeof() tests [c++/16675]
3666a048 2# Copyright 2014-2021 Free Software Foundation, Inc.
245a5f0b
KS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17standard_testfile .cc
18
19if {[skip_cplus_tests]} { continue }
20
5b362f04 21if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] } {
245a5f0b
KS
22 return -1
23}
24
25if {![runto_main]} {
26 perror "could not run to main"
27 continue
28}
29
30gdb_breakpoint [gdb_get_line_number "break here"]
31gdb_continue_to_breakpoint "break here"
32
33# Compare sizeof from the compiler and gdb. Do this once with the actual
34# type name and once with a reference variable.
35foreach v {char int long float double a4 a8 a12 Class Union Enum c4 u8 e12} {
36 gdb_test "print size_$v == sizeof (${v}&)" "= true"
37 gdb_test "print size_$v == sizeof (${v}_ref)" "= true"
38 gdb_test "print size_${v}p == sizeof (${v}*&)" "= true"
39 gdb_test "print size_${v}p == sizeof (${v}p_ref)" "= true"
40}