]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.compile/compile.c
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.compile / compile.c
CommitLineData
bb2ec1b3
TT
1/* This testcase is part of GDB, the GNU debugger.
2
3666a048 3 Copyright 2014-2021 Free Software Foundation, Inc.
bb2ec1b3
TT
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#define SOME_MACRO 23
19#define ARG_MACRO(X, Y) ((X) + (Y) - 1)
20
21
22enum enum_type {
23 ONE = 1,
24 TWO = 2
25};
26
27typedef int v4 __attribute__ ((vector_size (16)));
28
29union union_type;
30
31struct struct_type {
32 char charfield;
33 unsigned char ucharfield;
34 short shortfield;
35 unsigned short ushortfield;
36 int intfield;
37 unsigned int uintfield;
38 unsigned int bitfield : 3;
39 long longfield;
40 unsigned long ulongfield;
41 enum enum_type enumfield;
42 float floatfield;
43 double doublefield;
44 const union union_type *ptrfield;
08464196 45 volatile struct struct_type *selffield;
bb2ec1b3
TT
46 int arrayfield[5];
47 _Complex double complexfield;
48 _Bool boolfield;
49 v4 vectorfield;
50};
51
52typedef int inttypedef;
53
54union union_type {
55 int intfield;
56 inttypedef typedeffield;
57};
58
59/* volatile provides some coverage of the conversion code. */
60volatile struct struct_type struct_object;
61
62union union_type union_object;
63
64
65enum ulonger_enum_type {
66 REALLY_MINUS_1 = -1UL,
67};
68
69enum ulonger_enum_type ulonger;
70
71enum longer_enum_type {
72 MINUS_1 = -1,
73 FORCE_TO_LONG = 1L << ((8 * sizeof (long)) - 2)
74};
75
76enum longer_enum_type longer;
77
78int globalvar = 10;
79
80static void
81func_static (int addend)
82{
83 globalvar += addend;
84}
85
86void
87func_global (int subtrahend)
88{
89 globalvar -= subtrahend;
90}
91
92void
93no_args_or_locals (void)
94{
95 /* no_args_or_locals breakpoint */
96}
97
98int *intptr;
99int globalshadow = 10;
100static int staticshadow = 20;
101int externed = 7;
102
103int
104main (void)
105{
106 int localvar = 50;
107 int shadowed = 51;
108 int bound = 3;
109 int unresolved = 10;
110 int globalshadow = 100;
111 int staticshadow = 200;
112 int externed = 9;
113 int f = 0;
114
115 static int static_local = 77000;
116
117 {
118 int another_local = 7;
119 int shadowed = 52;
120 extern int unresolved;
121 extern int externed;
122
123 int vla[bound];
124
125 func_static (0); /* break-here */
126 no_args_or_locals ();
127 }
128
129 return 0;
130}