Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / complex.c
CommitLineData
4c38e0a4
JB
1/* Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010
2Free Software Foundation, Inc.
55944f3d
MC
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
a9762ec7
JB
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
55944f3d 10
a9762ec7
JB
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
55944f3d
MC
15
16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
55944f3d 18
f1c2644b
DJ
19/* Test taken from GCC. Verify that we can print a structure containing
20 a complex number. */
21
cb9aaed5
MC
22#include <stdlib.h>
23
f1c2644b
DJ
24typedef __complex__ float cf;
25struct x { char c; cf f; } __attribute__ ((__packed__));
26struct unpacked_x { char c; cf f; };
27extern void f4 (struct unpacked_x*);
28extern void f3 (void);
29extern void f2 (struct x*);
30extern void f1 (void);
31int
32main (void)
33{
34 f1 ();
35 f3 ();
36 exit (0);
37}
38
39void
40f1 (void)
41{
42 struct x s;
43 s.f = 1;
44 s.c = 42;
45 f2 (&s);
46}
47
48void
49f2 (struct x *y)
50{
51 if (y->f != 1 || y->c != 42)
52 abort ();
53}
54
55void
56f3 (void)
57{
58 struct unpacked_x s;
59 s.f = 1;
60 s.c = 42;
61 f4 (&s);
62}
63
64void
65f4 (struct unpacked_x *y)
66{
67 if (y->f != 1 || y->c != 42)
68 abort ();
69}
This page took 0.61994 seconds and 4 git commands to generate.