[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.cp / local-static.c
blob33ab2e352d2ed6dea5f164307b10fa1b1797b8f2
1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2002-2019 Free Software Foundation, Inc.
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.
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.
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/>. */
18 struct aggregate
20 int i1;
21 int i2;
22 int i3;
25 void keepalive_float (double *var) { }
26 void keepalive_int (int *var) { }
27 void keepalive_aggregate (struct aggregate *var) { }
29 #define PREFIXIFY(PREFIX, VAR) \
30 PREFIX ## _ ## VAR
32 #define DEF_STATICS(PREFIX) \
33 static int PREFIXIFY(PREFIX, s_var_int) = 4; \
34 static double PREFIXIFY(PREFIX, s_var_float) = 3.14f; \
35 static struct aggregate PREFIXIFY(PREFIX, s_var_aggregate) \
36 = { 1, 2, 3 }; \
38 keepalive_int (&PREFIXIFY(PREFIX, s_var_int)); \
39 keepalive_float (&PREFIXIFY(PREFIX, s_var_float)); \
40 keepalive_aggregate (&PREFIXIFY(PREFIX, s_var_aggregate));
42 #ifdef __cplusplus
44 struct S
46 void inline_method ()
48 DEF_STATICS (S_IM);
50 static void static_inline_method ()
52 DEF_STATICS (S_SIM);
55 void method ();
56 void method () const;
57 void method () volatile;
58 void method () volatile const;
60 static void static_method ();
63 S s;
64 const S c_s = {};
65 volatile S v_s = {};
66 const volatile S cv_s = {};
68 void
69 S::method ()
71 DEF_STATICS (S_M);
74 void
75 S::method () const
77 DEF_STATICS (S_M_C);
80 void
81 S::method () volatile
83 DEF_STATICS (S_M_V);
86 void
87 S::method () const volatile
89 DEF_STATICS (S_M_CV);
92 void
93 S::static_method ()
95 DEF_STATICS (S_SM);
98 template <typename T>
99 struct S2
101 void method ();
102 static void static_method ();
104 void inline_method ()
106 DEF_STATICS (S2_IM);
109 static void static_inline_method ()
111 DEF_STATICS (S2_SIM);
115 template<typename T>
116 void
117 S2<T>::method ()
119 DEF_STATICS (S2_M);
122 template<typename T>
123 void
124 S2<T>::static_method ()
126 DEF_STATICS (S2_SM);
129 S2<int> s2;
131 #endif
133 void
134 free_func (void)
136 DEF_STATICS (FF);
139 static inline void
140 free_inline_func (void)
142 DEF_STATICS (FIF);
146 main ()
148 for (int i = 0; i < 1000; i++)
150 free_func ();
151 free_inline_func ();
153 #ifdef __cplusplus
154 s.method ();
155 c_s.method ();
156 v_s.method ();
157 cv_s.method ();
158 s.inline_method ();
159 S::static_method ();
160 S::static_inline_method ();
162 s2.method ();
163 s2.inline_method ();
164 S2<int>::static_method ();
165 S2<int>::static_inline_method ();
166 #endif
169 return 0;