]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (C) 1992-2019 Free Software Foundation, Inc. |
54d79e99 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
54d79e99 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 8 | |
54d79e99 UD |
9 | The GNU C 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 GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 RM |
17 | |
18 | #ifndef _SYS_CDEFS_H | |
28f540f4 | 19 | #define _SYS_CDEFS_H 1 |
5107cf1d | 20 | |
a6ff34d7 UD |
21 | /* We are almost always included from features.h. */ |
22 | #ifndef _FEATURES_H | |
7688db91 UD |
23 | # include <features.h> |
24 | #endif | |
25 | ||
26 | /* The GNU libc does not support any K&R compilers or the traditional mode | |
27 | of ISO C compilers anymore. Check for some of the combinations not | |
28 | anymore supported. */ | |
29 | #if defined __GNUC__ && !defined __STDC__ | |
30 | # error "You need a ISO C conforming compiler to use the glibc headers" | |
a6ff34d7 | 31 | #endif |
28f540f4 RM |
32 | |
33 | /* Some user header file might have defined this before. */ | |
34 | #undef __P | |
d112ae30 | 35 | #undef __PMT |
28f540f4 RM |
36 | |
37 | #ifdef __GNUC__ | |
38 | ||
3871f58f AS |
39 | /* All functions, except those with callbacks or those that |
40 | synchronize memory, are leaf functions. */ | |
aa78043a UD |
41 | # if __GNUC_PREREQ (4, 6) && !defined _LIBC |
42 | # define __LEAF , __leaf__ | |
43 | # define __LEAF_ATTR __attribute__ ((__leaf__)) | |
44 | # else | |
45 | # define __LEAF | |
46 | # define __LEAF_ATTR | |
47 | # endif | |
48 | ||
dff14448 UD |
49 | /* GCC can always grok prototypes. For C++ programs we add throw() |
50 | to help it optimize the function calls. But this works only with | |
f377d022 UD |
51 | gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions |
52 | as non-throwing using a function attribute since programs can use | |
53 | the -fexceptions options for C code as well. */ | |
e071493f | 54 | # if !defined __cplusplus && __GNUC_PREREQ (3, 3) |
49a43d80 | 55 | # define __THROW __attribute__ ((__nothrow__ __LEAF)) |
3871f58f | 56 | # define __THROWNL __attribute__ ((__nothrow__)) |
49a43d80 | 57 | # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct |
7c3018f9 | 58 | # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct |
dff14448 | 59 | # else |
f377d022 UD |
60 | # if defined __cplusplus && __GNUC_PREREQ (2,8) |
61 | # define __THROW throw () | |
3871f58f | 62 | # define __THROWNL throw () |
aa78043a | 63 | # define __NTH(fct) __LEAF_ATTR fct throw () |
7c3018f9 | 64 | # define __NTHNL(fct) fct throw () |
f377d022 UD |
65 | # else |
66 | # define __THROW | |
3871f58f | 67 | # define __THROWNL |
f377d022 | 68 | # define __NTH(fct) fct |
7c3018f9 | 69 | # define __NTHNL(fct) fct |
f377d022 | 70 | # endif |
dff14448 | 71 | # endif |
4360eafd | 72 | |
28f540f4 RM |
73 | #else /* Not GCC. */ |
74 | ||
383e87c9 JM |
75 | # if (defined __cplusplus \ |
76 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) | |
77 | # define __inline inline | |
78 | # else | |
79 | # define __inline /* No inline functions. */ | |
80 | # endif | |
28f540f4 | 81 | |
9b767d19 | 82 | # define __THROW |
3871f58f | 83 | # define __THROWNL |
f377d022 | 84 | # define __NTH(fct) fct |
28f540f4 RM |
85 | |
86 | #endif /* GCC. */ | |
87 | ||
cab4d74b ZW |
88 | /* Compilers that are not clang may object to |
89 | #if defined __clang__ && __has_extension(...) | |
90 | even though they do not need to evaluate the right-hand side of the &&. */ | |
91 | #if defined __clang__ && defined __has_extension | |
92 | # define __glibc_clang_has_extension(ext) __has_extension (ext) | |
93 | #else | |
94 | # define __glibc_clang_has_extension(ext) 0 | |
95 | #endif | |
96 | ||
d19687d6 UD |
97 | /* These two macros are not used in glibc anymore. They are kept here |
98 | only because some other projects expect the macros to be defined. */ | |
99 | #define __P(args) args | |
100 | #define __PMT(args) args | |
101 | ||
28f540f4 RM |
102 | /* For these things, GCC behaves the ANSI way normally, |
103 | and the non-ANSI way under -traditional. */ | |
104 | ||
7f4e0e58 UD |
105 | #define __CONCAT(x,y) x ## y |
106 | #define __STRING(x) #x | |
28f540f4 RM |
107 | |
108 | /* This is not a typedef so `const __ptr_t' does the right thing. */ | |
7f4e0e58 | 109 | #define __ptr_t void * |
857fa1b8 RM |
110 | |
111 | ||
28f540f4 RM |
112 | /* C++ needs to know that types and declarations are C, not C++. */ |
113 | #ifdef __cplusplus | |
dfd2257a UD |
114 | # define __BEGIN_DECLS extern "C" { |
115 | # define __END_DECLS } | |
28f540f4 | 116 | #else |
dfd2257a UD |
117 | # define __BEGIN_DECLS |
118 | # define __END_DECLS | |
28f540f4 RM |
119 | #endif |
120 | ||
ab95290c | 121 | |
b5cc329c UD |
122 | /* Fortify support. */ |
123 | #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) | |
124 | #define __bos0(ptr) __builtin_object_size (ptr, 0) | |
125 | ||
d6cd6bf4 UD |
126 | #if __GNUC_PREREQ (4,3) |
127 | # define __warndecl(name, msg) \ | |
128 | extern void name (void) __attribute__((__warning__ (msg))) | |
129 | # define __warnattr(msg) __attribute__((__warning__ (msg))) | |
130 | # define __errordecl(name, msg) \ | |
131 | extern void name (void) __attribute__((__error__ (msg))) | |
132 | #else | |
133 | # define __warndecl(name, msg) extern void name (void) | |
134 | # define __warnattr(msg) | |
135 | # define __errordecl(name, msg) extern void name (void) | |
136 | #endif | |
b5cc329c | 137 | |
cb765808 ZW |
138 | /* Support for flexible arrays. |
139 | Headers that should use flexible arrays only if they're "real" | |
140 | (e.g. only if they won't affect sizeof()) should test | |
141 | #if __glibc_c99_flexarr_available. */ | |
142 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | |
a1620a4c | 143 | # define __flexarr [] |
cb765808 ZW |
144 | # define __glibc_c99_flexarr_available 1 |
145 | #elif __GNUC_PREREQ (2,97) | |
146 | /* GCC 2.97 supports C99 flexible array members as an extension, | |
147 | even when in C89 mode or compiling C++ (any version). */ | |
148 | # define __flexarr [] | |
149 | # define __glibc_c99_flexarr_available 1 | |
150 | #elif defined __GNUC__ | |
151 | /* Pre-2.97 GCC did not support C99 flexible arrays but did have | |
152 | an equivalent extension with slightly different notation. */ | |
153 | # define __flexarr [0] | |
154 | # define __glibc_c99_flexarr_available 1 | |
a1620a4c | 155 | #else |
a1620a4c | 156 | /* Some other non-C99 compiler. Approximate with [1]. */ |
cb765808 ZW |
157 | # define __flexarr [1] |
158 | # define __glibc_c99_flexarr_available 0 | |
a1620a4c UD |
159 | #endif |
160 | ||
161 | ||
01cad722 UD |
162 | /* __asm__ ("xyz") is used throughout the headers to rename functions |
163 | at the assembly language level. This is wrapped by the __REDIRECT | |
164 | macro, in order to support compilers that can do this some other | |
165 | way. When compilers don't support asm-names at all, we have to do | |
166 | preprocessor tricks instead (which don't have exactly the right | |
167 | semantics, but it's the best we can do). | |
168 | ||
169 | Example: | |
fbedbe9d | 170 | int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ |
01cad722 UD |
171 | |
172 | #if defined __GNUC__ && __GNUC__ >= 2 | |
173 | ||
5408c757 | 174 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) |
05f4d5cd UD |
175 | # ifdef __cplusplus |
176 | # define __REDIRECT_NTH(name, proto, alias) \ | |
177 | name proto __THROW __asm__ (__ASMNAME (#alias)) | |
edc5984d AS |
178 | # define __REDIRECT_NTHNL(name, proto, alias) \ |
179 | name proto __THROWNL __asm__ (__ASMNAME (#alias)) | |
05f4d5cd UD |
180 | # else |
181 | # define __REDIRECT_NTH(name, proto, alias) \ | |
f377d022 | 182 | name proto __asm__ (__ASMNAME (#alias)) __THROW |
edc5984d AS |
183 | # define __REDIRECT_NTHNL(name, proto, alias) \ |
184 | name proto __asm__ (__ASMNAME (#alias)) __THROWNL | |
05f4d5cd | 185 | # endif |
5408c757 UD |
186 | # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) |
187 | # define __ASMNAME2(prefix, cname) __STRING (prefix) cname | |
01cad722 UD |
188 | |
189 | /* | |
190 | #elif __SOME_OTHER_COMPILER__ | |
191 | ||
5408c757 UD |
192 | # define __REDIRECT(name, proto, alias) name proto; \ |
193 | _Pragma("let " #name " = " #alias) | |
01cad722 UD |
194 | */ |
195 | #endif | |
196 | ||
197 | /* GCC has various useful declarations that can be made with the | |
28f540f4 | 198 | `__attribute__' syntax. All of the ways we use this do fine if |
01cad722 | 199 | they are omitted for compilers that don't understand it. */ |
dfd2257a | 200 | #if !defined __GNUC__ || __GNUC__ < 2 |
e9e9b245 | 201 | # define __attribute__(xyz) /* Ignore */ |
ae177b9c UD |
202 | #endif |
203 | ||
e9e9b245 UD |
204 | /* At some point during the gcc 2.96 development the `malloc' attribute |
205 | for functions was introduced. We don't want to use it unconditionally | |
206 | (although this would be possible) since it generates warnings. */ | |
ae177b9c UD |
207 | #if __GNUC_PREREQ (2,96) |
208 | # define __attribute_malloc__ __attribute__ ((__malloc__)) | |
209 | #else | |
210 | # define __attribute_malloc__ /* Ignore */ | |
01cad722 | 211 | #endif |
2f6d1f1b | 212 | |
2f62b9ee MF |
213 | /* Tell the compiler which arguments to an allocation function |
214 | indicate the size of the allocation. */ | |
215 | #if __GNUC_PREREQ (4, 3) | |
216 | # define __attribute_alloc_size__(params) \ | |
217 | __attribute__ ((__alloc_size__ params)) | |
218 | #else | |
219 | # define __attribute_alloc_size__(params) /* Ignore. */ | |
220 | #endif | |
221 | ||
ca5a4c3c AJ |
222 | /* At some point during the gcc 2.96 development the `pure' attribute |
223 | for functions was introduced. We don't want to use it unconditionally | |
224 | (although this would be possible) since it generates warnings. */ | |
225 | #if __GNUC_PREREQ (2,96) | |
226 | # define __attribute_pure__ __attribute__ ((__pure__)) | |
227 | #else | |
228 | # define __attribute_pure__ /* Ignore */ | |
229 | #endif | |
230 | ||
295e904f MP |
231 | /* This declaration tells the compiler that the value is constant. */ |
232 | #if __GNUC_PREREQ (2,5) | |
233 | # define __attribute_const__ __attribute__ ((__const__)) | |
234 | #else | |
235 | # define __attribute_const__ /* Ignore */ | |
236 | #endif | |
237 | ||
d3640b91 UD |
238 | /* At some point during the gcc 3.1 development the `used' attribute |
239 | for functions was introduced. We don't want to use it unconditionally | |
240 | (although this would be possible) since it generates warnings. */ | |
241 | #if __GNUC_PREREQ (3,1) | |
242 | # define __attribute_used__ __attribute__ ((__used__)) | |
fb23eb25 | 243 | # define __attribute_noinline__ __attribute__ ((__noinline__)) |
d3640b91 UD |
244 | #else |
245 | # define __attribute_used__ __attribute__ ((__unused__)) | |
fb23eb25 | 246 | # define __attribute_noinline__ /* Ignore */ |
d3640b91 UD |
247 | #endif |
248 | ||
cab4d74b | 249 | /* Since version 3.2, gcc allows marking deprecated functions. */ |
3b7ed871 UD |
250 | #if __GNUC_PREREQ (3,2) |
251 | # define __attribute_deprecated__ __attribute__ ((__deprecated__)) | |
252 | #else | |
253 | # define __attribute_deprecated__ /* Ignore */ | |
254 | #endif | |
255 | ||
cab4d74b ZW |
256 | /* Since version 4.5, gcc also allows one to specify the message printed |
257 | when a deprecated function is used. clang claims to be gcc 4.2, but | |
258 | may also support this feature. */ | |
34a5a146 JM |
259 | #if __GNUC_PREREQ (4,5) \ |
260 | || __glibc_clang_has_extension (__attribute_deprecated_with_message__) | |
cab4d74b ZW |
261 | # define __attribute_deprecated_msg__(msg) \ |
262 | __attribute__ ((__deprecated__ (msg))) | |
263 | #else | |
264 | # define __attribute_deprecated_msg__(msg) __attribute_deprecated__ | |
265 | #endif | |
266 | ||
ca8d5a5f UD |
267 | /* At some point during the gcc 2.8 development the `format_arg' attribute |
268 | for functions was introduced. We don't want to use it unconditionally | |
f369623d UD |
269 | (although this would be possible) since it generates warnings. |
270 | If several `format_arg' attributes are given for the same function, in | |
271 | gcc-3.0 and older, all but the last one are ignored. In newer gccs, | |
272 | all designated arguments are considered. */ | |
ca8d5a5f UD |
273 | #if __GNUC_PREREQ (2,8) |
274 | # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) | |
275 | #else | |
276 | # define __attribute_format_arg__(x) /* Ignore */ | |
277 | #endif | |
278 | ||
66e23ba1 UD |
279 | /* At some point during the gcc 2.97 development the `strfmon' format |
280 | attribute for functions was introduced. We don't want to use it | |
281 | unconditionally (although this would be possible) since it | |
282 | generates warnings. */ | |
283 | #if __GNUC_PREREQ (2,97) | |
284 | # define __attribute_format_strfmon__(a,b) \ | |
285 | __attribute__ ((__format__ (__strfmon__, a, b))) | |
286 | #else | |
287 | # define __attribute_format_strfmon__(a,b) /* Ignore */ | |
288 | #endif | |
289 | ||
8a1f658b UD |
290 | /* The nonull function attribute allows to mark pointer parameters which |
291 | must not be NULL. */ | |
292 | #if __GNUC_PREREQ (3,3) | |
293 | # define __nonnull(params) __attribute__ ((__nonnull__ params)) | |
294 | #else | |
295 | # define __nonnull(params) | |
296 | #endif | |
297 | ||
5cf53cc2 UD |
298 | /* If fortification mode, we warn about unused results of certain |
299 | function calls which can lead to problems. */ | |
9ee4c017 UD |
300 | #if __GNUC_PREREQ (3,4) |
301 | # define __attribute_warn_unused_result__ \ | |
302 | __attribute__ ((__warn_unused_result__)) | |
303 | # if __USE_FORTIFY_LEVEL > 0 | |
304 | # define __wur __attribute_warn_unused_result__ | |
305 | # endif | |
5cf53cc2 | 306 | #else |
9ee4c017 UD |
307 | # define __attribute_warn_unused_result__ /* empty */ |
308 | #endif | |
309 | #ifndef __wur | |
5cf53cc2 UD |
310 | # define __wur /* Ignore */ |
311 | #endif | |
312 | ||
88764ae2 UD |
313 | /* Forces a function to be always inlined. */ |
314 | #if __GNUC_PREREQ (3,2) | |
e0835a53 CD |
315 | /* The Linux kernel defines __always_inline in stddef.h (283d7573), and |
316 | it conflicts with this definition. Therefore undefine it first to | |
317 | allow either header to be included first. */ | |
318 | # undef __always_inline | |
88764ae2 UD |
319 | # define __always_inline __inline __attribute__ ((__always_inline__)) |
320 | #else | |
e0835a53 | 321 | # undef __always_inline |
88764ae2 UD |
322 | # define __always_inline __inline |
323 | #endif | |
324 | ||
5ac3ea17 MP |
325 | /* Associate error messages with the source location of the call site rather |
326 | than with the source location inside the function. */ | |
327 | #if __GNUC_PREREQ (4,3) | |
328 | # define __attribute_artificial__ __attribute__ ((__artificial__)) | |
329 | #else | |
330 | # define __attribute_artificial__ /* Ignore */ | |
331 | #endif | |
332 | ||
884ddc50 SP |
333 | /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 |
334 | inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ | |
335 | or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions | |
336 | older than 4.3 may define these macros and still not guarantee GNU inlining | |
602f80ec SP |
337 | semantics. |
338 | ||
339 | clang++ identifies itself as gcc-4.2, but has support for GNU inlining | |
a1b02ae7 | 340 | semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and |
602f80ec SP |
341 | __GNUC_GNU_INLINE__ macro definitions. */ |
342 | #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ | |
343 | || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ | |
344 | || defined __GNUC_GNU_INLINE__))) | |
884ddc50 | 345 | # if defined __GNUC_STDC_INLINE__ || defined __cplusplus |
de1c3ebb | 346 | # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) |
5ac3ea17 | 347 | # define __extern_always_inline \ |
b037a293 | 348 | extern __always_inline __attribute__ ((__gnu_inline__)) |
de1c3ebb UD |
349 | # else |
350 | # define __extern_inline extern __inline | |
5ac3ea17 | 351 | # define __extern_always_inline extern __always_inline |
de1c3ebb | 352 | # endif |
884ddc50 SP |
353 | #endif |
354 | ||
355 | #ifdef __extern_always_inline | |
356 | # define __fortify_function __extern_always_inline __attribute_artificial__ | |
de1c3ebb UD |
357 | #endif |
358 | ||
359 | /* GCC 4.3 and above allow passing all anonymous arguments of an | |
360 | __extern_always_inline function to some other vararg function. */ | |
3dd79d63 | 361 | #if __GNUC_PREREQ (4,3) |
de1c3ebb | 362 | # define __va_arg_pack() __builtin_va_arg_pack () |
3a50811c | 363 | # define __va_arg_pack_len() __builtin_va_arg_pack_len () |
b037a293 UD |
364 | #endif |
365 | ||
8325d82c UD |
366 | /* It is possible to compile containing GCC extensions even if GCC is |
367 | run in pedantic mode if the uses are carefully marked using the | |
368 | `__extension__' keyword. But this is not generally available before | |
369 | version 2.8. */ | |
4360eafd | 370 | #if !__GNUC_PREREQ (2,8) |
8325d82c | 371 | # define __extension__ /* Ignore */ |
8325d82c UD |
372 | #endif |
373 | ||
a6ff34d7 | 374 | /* __restrict is known in EGCS 1.2 and above. */ |
4360eafd | 375 | #if !__GNUC_PREREQ (2,92) |
383e87c9 JM |
376 | # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L |
377 | # define __restrict restrict | |
378 | # else | |
379 | # define __restrict /* Ignore */ | |
380 | # endif | |
a6ff34d7 | 381 | #endif |
2f6d1f1b | 382 | |
98cbe360 UD |
383 | /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is |
384 | array_name[restrict] | |
b912ca11 | 385 | GCC 3.1 supports this. */ |
852d75f9 | 386 | #if __GNUC_PREREQ (3,1) && !defined __GNUG__ |
b912ca11 UD |
387 | # define __restrict_arr __restrict |
388 | #else | |
389 | # ifdef __GNUC__ | |
390 | # define __restrict_arr /* Not supported in old GCC. */ | |
391 | # else | |
392 | # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | |
393 | # define __restrict_arr restrict | |
394 | # else | |
395 | /* Some other non-C99 compiler. */ | |
396 | # define __restrict_arr /* Not supported. */ | |
397 | # endif | |
398 | # endif | |
399 | #endif | |
98cbe360 | 400 | |
4af3879c | 401 | #if __GNUC__ >= 3 |
4858fa2a RM |
402 | # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) |
403 | # define __glibc_likely(cond) __builtin_expect ((cond), 1) | |
4af3879c | 404 | #else |
4858fa2a RM |
405 | # define __glibc_unlikely(cond) (cond) |
406 | # define __glibc_likely(cond) (cond) | |
4af3879c SP |
407 | #endif |
408 | ||
e27f41ba L |
409 | #ifdef __has_attribute |
410 | # define __glibc_has_attribute(attr) __has_attribute (attr) | |
411 | #else | |
412 | # define __glibc_has_attribute(attr) 0 | |
413 | #endif | |
414 | ||
4e75c2a4 FW |
415 | #ifdef __has_include |
416 | # define __glibc_has_include(header) __has_include (header) | |
417 | #else | |
418 | # define __glibc_has_include(header) 0 | |
419 | #endif | |
420 | ||
d12704c7 SP |
421 | #if (!defined _Noreturn \ |
422 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ | |
423 | && !__GNUC_PREREQ (4,7)) | |
c4c41244 PE |
424 | # if __GNUC_PREREQ (2,8) |
425 | # define _Noreturn __attribute__ ((__noreturn__)) | |
426 | # else | |
427 | # define _Noreturn | |
428 | # endif | |
429 | #endif | |
430 | ||
7532837d MS |
431 | #if __GNUC_PREREQ (8, 0) |
432 | /* Describes a char array whose address can safely be passed as the first | |
433 | argument to strncpy and strncat, as the char array is not necessarily | |
434 | a NUL-terminated string. */ | |
435 | # define __attribute_nonstring__ __attribute__ ((__nonstring__)) | |
436 | #else | |
437 | # define __attribute_nonstring__ | |
438 | #endif | |
439 | ||
1626a1cf MS |
440 | /* Undefine (also defined in libc-symbols.h). */ |
441 | #undef __attribute_copy__ | |
442 | #if __GNUC_PREREQ (9, 0) | |
443 | /* Copies attributes from the declaration or type referenced by | |
444 | the argument. */ | |
445 | # define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) | |
446 | #else | |
447 | # define __attribute_copy__(arg) | |
448 | #endif | |
449 | ||
3999d26e PE |
450 | #if (!defined _Static_assert && !defined __cplusplus \ |
451 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ | |
452 | && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) | |
453 | # define _Static_assert(expr, diagnostic) \ | |
454 | extern int (*__Static_assert_function (void)) \ | |
455 | [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] | |
456 | #endif | |
457 | ||
c6251f03 | 458 | #include <bits/wordsize.h> |
0acb8a2a | 459 | #include <bits/long-double.h> |
c6251f03 RM |
460 | |
461 | #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH | |
462 | # define __LDBL_COMPAT 1 | |
463 | # ifdef __REDIRECT | |
464 | # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) | |
465 | # define __LDBL_REDIR(name, proto) \ | |
466 | __LDBL_REDIR1 (name, proto, __nldbl_##name) | |
467 | # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) | |
468 | # define __LDBL_REDIR_NTH(name, proto) \ | |
469 | __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) | |
54e98f69 RM |
470 | # define __LDBL_REDIR1_DECL(name, alias) \ |
471 | extern __typeof (name) name __asm (__ASMNAME (#alias)); | |
c6251f03 | 472 | # define __LDBL_REDIR_DECL(name) \ |
54e98f69 | 473 | extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); |
ac97dec1 UD |
474 | # define __REDIRECT_LDBL(name, proto, alias) \ |
475 | __LDBL_REDIR1 (name, proto, __nldbl_##alias) | |
476 | # define __REDIRECT_NTH_LDBL(name, proto, alias) \ | |
477 | __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) | |
c6251f03 RM |
478 | # endif |
479 | #endif | |
480 | #if !defined __LDBL_COMPAT || !defined __REDIRECT | |
481 | # define __LDBL_REDIR1(name, proto, alias) name proto | |
482 | # define __LDBL_REDIR(name, proto) name proto | |
483 | # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW | |
484 | # define __LDBL_REDIR_NTH(name, proto) name proto __THROW | |
485 | # define __LDBL_REDIR_DECL(name) | |
ac97dec1 UD |
486 | # ifdef __REDIRECT |
487 | # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) | |
488 | # define __REDIRECT_NTH_LDBL(name, proto, alias) \ | |
489 | __REDIRECT_NTH (name, proto, alias) | |
490 | # endif | |
c6251f03 RM |
491 | #endif |
492 | ||
bfbd1de1 | 493 | /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is |
809b72df ZW |
494 | intended for use in preprocessor macros. |
495 | ||
496 | Note: MESSAGE must be a _single_ string; concatenation of string | |
497 | literals is not supported. */ | |
498 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) | |
bfbd1de1 FW |
499 | # define __glibc_macro_warning1(message) _Pragma (#message) |
500 | # define __glibc_macro_warning(message) \ | |
501 | __glibc_macro_warning1 (GCC warning message) | |
502 | #else | |
503 | # define __glibc_macro_warning(msg) | |
504 | #endif | |
505 | ||
6913ad65 GG |
506 | /* Generic selection (ISO C11) is a C-only feature, available in GCC |
507 | since version 4.9. Previous versions do not provide generic | |
508 | selection, even though they might set __STDC_VERSION__ to 201112L, | |
509 | when in -std=c11 mode. Thus, we must check for !defined __GNUC__ | |
510 | when testing __STDC_VERSION__ for generic selection support. | |
477bf19a GG |
511 | On the other hand, Clang also defines __GNUC__, so a clang-specific |
512 | check is required to enable the use of generic selection. */ | |
6913ad65 GG |
513 | #if !defined __cplusplus \ |
514 | && (__GNUC_PREREQ (4, 9) \ | |
515 | || __glibc_clang_has_extension (c_generic_selections) \ | |
516 | || (!defined __GNUC__ && defined __STDC_VERSION__ \ | |
517 | && __STDC_VERSION__ >= 201112L)) | |
477bf19a GG |
518 | # define __HAVE_GENERIC_SELECTION 1 |
519 | #else | |
520 | # define __HAVE_GENERIC_SELECTION 0 | |
521 | #endif | |
522 | ||
28f540f4 | 523 | #endif /* sys/cdefs.h */ |