]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/17_intro/names.cc
1 // Copyright (C) 2017-2024 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library 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.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
19 // { dg-add-options no_pch }
21 // Define macros for some common variables names that we must not use for
22 // naming variables, parameters etc. in the library.
23 // N.B. we cannot use '#pragma GCC poison A' because that also prevents using
24 // these names even as macro arguments, e.g. #define FOO(A) BAR(A)
33 // <complex.h> defines I
51 #if __cplusplus >= 201103L
52 // <random> defines member functions called a() and b()
57 // <queue> and <stack> defined data members called c
58 #if __cplusplus <= 201703L
59 // <chrono> defines operator""d in C++20
61 // <numbers> defines std::numbers::e in C++20
66 #if __cplusplus >= 201402L
67 // <chrono> defines operator ""h in C++14
68 // <complex> defines operator ""i in C++14
74 #if __cplusplus >= 201103L
75 // <random> defines member functions called k()
80 #if __cplusplus >= 201103L
81 // <random> defines member functions called m() and n()
87 #if __cplusplus >= 201103L
88 // <random> defines member functions called p()
94 #if __cplusplus >= 201103L
95 // <random> defines member functions called s() and t()
96 // <chrono> and <string> define operator ""s in C++14
105 #if __cplusplus <= 201703L
106 // <chrono> defines operator""y in C++20
126 #if __cplusplus < 201103L
127 #define uses_allocator (
130 #if __cplusplus < 201402L
131 // <complex> defines operator""il
135 #if __cplusplus < 201703L
136 // <charconv> defines to_chars_result::ptr and to_chars_result::ec
141 // These clash with newlib so don't use them.
142 # define __lockable cannot be used as an identifier
143 # define __packed cannot be used as an identifier
144 # define __unused cannot be used as an identifier
145 # define __used cannot be used as an identifier
148 #define __weak predefined qualifier on darwin
149 #define __strong predefined qualifier on darwin
152 // Common template parameter names
153 #define OutputIterator OutputIterator is not a reserved name
154 #define InputIterator InputIterator is not a reserved name
155 #define ForwardIterator ForwardIterator is not a reserved name
156 #define BidirectionalIterator BidirectionalIterator is not a reserved name
157 #define RandomAccessIterator RandomAccessIterator is not a reserved name
158 #define RandomAccessOutputIterator RandomAccessOutputIterator is not a reserved name
159 #define RAI RAI is not a reserved name
160 #define RAIter RAIter is not a reserved name
161 #define FwdIter FwdIter is not a reserved name
162 #define OutIter OutIter is not a reserved name
163 #define InIter InIter is not a reserved name
165 #define Alloc Alloc is not a reserved name
166 #define BinaryFunction1 BinaryFunction1 is not a reserved name
167 #define BinaryFunction2 BinaryFunction2 is not a reserved name
168 #define BinaryOperation BinaryOperation is not a reserved name
169 #define Char Char is not a reserved name
170 #define CharT CharT is not a reserved name
171 #define Cmp Cmp is not a reserved name
172 #define Compare Compare is not a reserved name
173 #define Const_Iterator Const_Iterator is not a reserved name
174 #define Const_Key_Reference Const_Key_Reference is not a reserved name
175 #define Const_Node_Iter Const_Node_Iter is not a reserved name
176 #define Const_Pointer Const_Pointer is not a reserved name
177 #define Const_Reference Const_Reference is not a reserved name
178 #define Data Data is not a reserved name
179 #define DiffType DiffType is not a reserved name
180 #define Eq Eq is not a reserved name
181 #define ExecPolicy ExecPolicy is not a reserved name
182 #define Expected Expected is not a reserved name
183 #define External_Load_Access External_Load_Access is not a reserved name
184 #define External_Size_Access External_Size_Access is not a reserved name
185 #define Fn Fn is not a reserved name
186 #define Function Function is not a reserved name
187 #define Functor Functor is not a reserved name
188 #define Hash Hash is not a reserved name
189 #define H1 H1 is not a reserved name
190 #define H2 H2 is not a reserved name
191 #define Head Head is not a reserved name
192 #define IsVector IsVector is not a reserved name
193 #define It It is not a reserved name
194 #define Iter Iter is not a reserved name
195 #define Iterator Iterator is not a reserved name
196 #define Key Key is not a reserved name
197 #define Mapped Mapped is not a reserved name
198 #define Node Node is not a reserved name
199 #define Node_iter Node_iter is not a reserved name
200 #define Node_ptr Node_ptr is not a reserved name
201 #define Overflow Overflow is not a reserved name
202 #define Pointer Pointer is not a reserved name
203 #define Policy Policy is not a reserved name
204 #define Pred Pred is not a reserved name
205 #define Proj Proj is not a reserved name
206 #define Proj1 Proj1 is not a reserved name
207 #define Proj2 Proj2 is not a reserved name
208 #define Ptr Ptr is not a reserved name
209 #define Reference Reference is not a reserved name
210 #define Seq Seq is not a reserved name
211 #define Seq_RAIter Seq_RAIter is not a reserved name
212 #define Series Series is not a reserved name
213 #define Set Set is not a reserved name
214 #define Size Size is not a reserved name
215 #define String String is not a reserved name
216 #define Tp Tp is not a reserved name
217 #define TQual TQual is not a reserved name
218 #define Traits Traits is not a reserved name
219 #define Type Type is not a reserved name
220 #define UQual UQual is not a reserved name
221 #define Value Value is not a reserved name
222 #define ValueT ValueT is not a reserved name
223 #define ValueType ValueType is not a reserved name
226 // Windows SAL annotations
227 #define _In_ cannot be used as an identifier
228 #define _Inout_ cannot be used as an identifier
229 #define _Out_ cannot be used as an identifier
230 #define _Reserved_ cannot be used as an identifier
231 #define __inout cannot be used as an identifier
232 #define __in_opt cannot be used as an identifier
233 #define __out_opt cannot be used as an identifier
237 // See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html
242 // <sys/var.h> defines vario::v
244 // <sys/timer.h> defines trb::func and cputime_tmr::func
246 // <sys/thread.h> defines tstate::policy
251 // inttypes.h: extern intmax_t imaxabs(intmax_t j);
260 #if defined (__linux__) && defined (__arm__)
261 // <sys/ucontext.h> defines fpregset_t::fpregs::j
265 #if defined (__linux__) && defined (__powerpc__)
266 // <asm/types.h> defines __vector128::u
270 #if defined (__linux__) && defined (__sparc__)
274 #if defined (__linux__) || defined (__gnu_hurd__)
275 #if __has_include(<features.h>)
276 #include <features.h>
277 #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 19
278 // Glibc defines this prior to 2.19
284 #if __has_include(<newlib.h>)
285 // newlib's <sys/cdefs.h> defines these as macros.
290 // newlib's <time.h> defines __tzrule_type with these members.
295 // newlib's <math.h> uses this for parameters
297 // newlib's <inttypes.h> uses this for parameters
302 // <fenv.h> defines these as members of fex_numeric_t
308 // See https://gcc.gnu.org/ml/libstdc++/2019-05/msg00175.html
310 // <sys/timespec_util.h> uses this as parameter
312 // <stdlib.h> uses this as member of drand48_data
318 #include <_vxworks-versions.h>
320 // Some VxWorks 6 or 7 headers are using those.
325 // arch/ppc/ffs/ArchLib.h
336 // VxWorks >= 7 specificities
338 #if _VXWORKS_MAJOR_GE(7)
340 // regs.h regs structure has a field 'r'
344 // in bootLib.h, bootParamCheck has parameters x, a-f
351 // in sysLib.h, func appears as a formal parameter name
355 #endif // VxWorks Major >= 7
357 #endif // __VXWORKS__
361 // <stdlib.h> defines _CRT_FLOAT::f
363 // <stdlib.h> defines _CRT_DOUBLE::x and _LONGDOUBLE::x
365 // <math.h> defines _complex::x and _complex::y
369 #include <bits/stdc++.h>