1 /* Copyright (C) 1992-2021 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public 6 License as published by the Free Software Foundation; either 7 version 3 of the License, or (at your option) any later version. 8 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 12 General Public License for more details. 13 14 You should have received a copy of the GNU General Public 15 License along with the GNU C Library; if not, see 16 <https://www.gnu.org/licenses/>. */ 17 18 #ifndef _SYS_CDEFS_H 19 #define _SYS_CDEFS_H 1 20 21 /* We are almost always included from features.h. */ 22 #ifndef _FEATURES_H 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 supported anymore. */ 29 #if defined __GNUC__ && !defined __STDC__ 30 # error "You need a ISO C conforming compiler to use the glibc headers" 31 #endif 32 33 /* Some user header file might have defined this before. */ 34 #undef __P 35 #undef __PMT 36 37 /* Compilers that lack __has_attribute may object to 38 #if defined __has_attribute && __has_attribute (...) 39 even though they do not need to evaluate the right-hand side of the &&. 40 Similarly for __has_builtin, etc. */ 41 #ifdef __has_attribute 42 # define __glibc_has_attribute(attr) __has_attribute (attr) 43 #else 44 # define __glibc_has_attribute(attr) 0 45 #endif 46 #ifdef __has_builtin 47 # define __glibc_has_builtin(name) __has_builtin (name) 48 #else 49 # define __glibc_has_builtin(name) 0 50 #endif 51 #ifdef __has_extension 52 # define __glibc_has_extension(ext) __has_extension (ext) 53 #else 54 # define __glibc_has_extension(ext) 0 55 #endif 56 57 #if defined __GNUC__ || defined __clang__ 58 59 /* All functions, except those with callbacks or those that 60 synchronize memory, are leaf functions. */ 61 # if __GNUC_PREREQ (4, 6) && !defined _LIBC 62 # define __LEAF , __leaf__ 63 # define __LEAF_ATTR __attribute__ ((__leaf__)) 64 # else 65 # define __LEAF 66 # define __LEAF_ATTR 67 # endif 68 69 /* GCC can always grok prototypes. For C++ programs we add throw() 70 to help it optimize the function calls. But this only works with 71 gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions 72 as non-throwing using a function attribute since programs can use 73 the -fexceptions options for C code as well. */ 74 # if !defined __cplusplus \ 75 && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) 76 # define __THROW __attribute__ ((__nothrow__ __LEAF)) 77 # define __THROWNL __attribute__ ((__nothrow__)) 78 # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct 79 # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct 80 # else 81 # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) 82 # if __cplusplus >= 201103L 83 # define __THROW noexcept (true) 84 # else 85 # define __THROW throw () 86 # endif 87 # define __THROWNL __THROW 88 # define __NTH(fct) __LEAF_ATTR fct __THROW 89 # define __NTHNL(fct) fct __THROW 90 # else 91 # define __THROW 92 # define __THROWNL 93 # define __NTH(fct) fct 94 # define __NTHNL(fct) fct 95 # endif 96 # endif 97 98 #else /* Not GCC or clang. */ 99 100 # if (defined __cplusplus \ 101 || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) 102 # define __inline inline 103 # else 104 # define __inline /* No inline functions. */ 105 # endif 106 107 # define __THROW 108 # define __THROWNL 109 # define __NTH(fct) fct 110 111 #endif /* GCC || clang. */ 112 113 /* These two macros are not used in glibc anymore. They are kept here 114 only because some other projects expect the macros to be defined. */ 115 #define __P(args) args 116 #define __PMT(args) args 117 118 /* For these things, GCC behaves the ANSI way normally, 119 and the non-ANSI way under -traditional. */ 120 121 #define __CONCAT(x,y) x ## y 122 #define __STRING(x) #x 123 124 /* This is not a typedef so `const __ptr_t' does the right thing. */ 125 #define __ptr_t void * 126 127 128 /* C++ needs to know that types and declarations are C, not C++. */ 129 #ifdef __cplusplus 130 # define __BEGIN_DECLS extern "C" { 131 # define __END_DECLS } 132 #else 133 # define __BEGIN_DECLS 134 # define __END_DECLS 135 #endif 136 137 138 /* Fortify support. */ 139 #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) 140 #define __bos0(ptr) __builtin_object_size (ptr, 0) 141 142 /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ 143 #if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) 144 # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) 145 # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) 146 #else 147 # define __glibc_objsize0(__o) __bos0 (__o) 148 # define __glibc_objsize(__o) __bos (__o) 149 #endif 150 151 #if __GNUC_PREREQ (4,3) 152 # define __warnattr(msg) __attribute__((__warning__ (msg))) 153 # define __errordecl(name, msg) \ 154 extern void name (void) __attribute__((__error__ (msg))) 155 #else 156 # define __warnattr(msg) 157 # define __errordecl(name, msg) extern void name (void) 158 #endif 159 160 /* Support for flexible arrays. 161 Headers that should use flexible arrays only if they're "real" 162 (e.g. only if they won't affect sizeof()) should test 163 #if __glibc_c99_flexarr_available. */ 164 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc 165 # define __flexarr [] 166 # define __glibc_c99_flexarr_available 1 167 #elif __GNUC_PREREQ (2,97) || defined __clang__ 168 /* GCC 2.97 and clang support C99 flexible array members as an extension, 169 even when in C89 mode or compiling C++ (any version). */ 170 # define __flexarr [] 171 # define __glibc_c99_flexarr_available 1 172 #elif defined __GNUC__ 173 /* Pre-2.97 GCC did not support C99 flexible arrays but did have 174 an equivalent extension with slightly different notation. */ 175 # define __flexarr [0] 176 # define __glibc_c99_flexarr_available 1 177 #else 178 /* Some other non-C99 compiler. Approximate with [1]. */ 179 # define __flexarr [1] 180 # define __glibc_c99_flexarr_available 0 181 #endif 182 183 184 /* __asm__ ("xyz") is used throughout the headers to rename functions 185 at the assembly language level. This is wrapped by the __REDIRECT 186 macro, in order to support compilers that can do this some other 187 way. When compilers don't support asm-names at all, we have to do 188 preprocessor tricks instead (which don't have exactly the right 189 semantics, but it's the best we can do). 190 191 Example: 192 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ 193 194 #if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4) 195 196 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) 197 # ifdef __cplusplus 198 # define __REDIRECT_NTH(name, proto, alias) \ 199 name proto __THROW __asm__ (__ASMNAME (#alias)) 200 # define __REDIRECT_NTHNL(name, proto, alias) \ 201 name proto __THROWNL __asm__ (__ASMNAME (#alias)) 202 # else 203 # define __REDIRECT_NTH(name, proto, alias) \ 204 name proto __asm__ (__ASMNAME (#alias)) __THROW 205 # define __REDIRECT_NTHNL(name, proto, alias) \ 206 name proto __asm__ (__ASMNAME (#alias)) __THROWNL 207 # endif 208 # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) 209 # define __ASMNAME2(prefix, cname) __STRING (prefix) cname 210 211 /* 212 #elif __SOME_OTHER_COMPILER__ 213 214 # define __REDIRECT(name, proto, alias) name proto; \ 215 _Pragma("let " #name " = " #alias) 216 */ 217 #endif 218 219 /* GCC and clang have various useful declarations that can be made with 220 the '__attribute__' syntax. All of the ways we use this do fine if 221 they are omitted for compilers that don't understand it. */ 222 #if !(defined __GNUC__ || defined __clang__) 223 # define __attribute__(xyz) /* Ignore */ 224 #endif 225 226 /* At some point during the gcc 2.96 development the `malloc' attribute 227 for functions was introduced. We don't want to use it unconditionally 228 (although this would be possible) since it generates warnings. */ 229 #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) 230 # define __attribute_malloc__ __attribute__ ((__malloc__)) 231 #else 232 # define __attribute_malloc__ /* Ignore */ 233 #endif 234 235 /* Tell the compiler which arguments to an allocation function 236 indicate the size of the allocation. */ 237 #if __GNUC_PREREQ (4, 3) 238 # define __attribute_alloc_size__(params) \ 239 __attribute__ ((__alloc_size__ params)) 240 #else 241 # define __attribute_alloc_size__(params) /* Ignore. */ 242 #endif 243 244 /* At some point during the gcc 2.96 development the `pure' attribute 245 for functions was introduced. We don't want to use it unconditionally 246 (although this would be possible) since it generates warnings. */ 247 #if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) 248 # define __attribute_pure__ __attribute__ ((__pure__)) 249 #else 250 # define __attribute_pure__ /* Ignore */ 251 #endif 252 253 /* This declaration tells the compiler that the value is constant. */ 254 #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) 255 # define __attribute_const__ __attribute__ ((__const__)) 256 #else 257 # define __attribute_const__ /* Ignore */ 258 #endif 259 260 /* At some point during the gcc 3.1 development the `used' attribute 261 for functions was introduced. We don't want to use it unconditionally 262 (although this would be possible) since it generates warnings. */ 263 #if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) 264 # define __attribute_used__ __attribute__ ((__used__)) 265 # define __attribute_noinline__ __attribute__ ((__noinline__)) 266 #else 267 # define __attribute_used__ __attribute__ ((__unused__)) 268 # define __attribute_noinline__ /* Ignore */ 269 #endif 270 271 /* Since version 3.2, gcc allows marking deprecated functions. */ 272 #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) 273 # define __attribute_deprecated__ __attribute__ ((__deprecated__)) 274 #else 275 # define __attribute_deprecated__ /* Ignore */ 276 #endif 277 278 /* Since version 4.5, gcc also allows one to specify the message printed 279 when a deprecated function is used. clang claims to be gcc 4.2, but 280 may also support this feature. */ 281 #if __GNUC_PREREQ (4,5) \ 282 || __glibc_has_extension (__attribute_deprecated_with_message__) 283 # define __attribute_deprecated_msg__(msg) \ 284 __attribute__ ((__deprecated__ (msg))) 285 #else 286 # define __attribute_deprecated_msg__(msg) __attribute_deprecated__ 287 #endif 288 289 /* At some point during the gcc 2.8 development the `format_arg' attribute 290 for functions was introduced. We don't want to use it unconditionally 291 (although this would be possible) since it generates warnings. 292 If several `format_arg' attributes are given for the same function, in 293 gcc-3.0 and older, all but the last one are ignored. In newer gccs, 294 all designated arguments are considered. */ 295 #if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) 296 # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) 297 #else 298 # define __attribute_format_arg__(x) /* Ignore */ 299 #endif 300 301 /* At some point during the gcc 2.97 development the `strfmon' format 302 attribute for functions was introduced. We don't want to use it 303 unconditionally (although this would be possible) since it 304 generates warnings. */ 305 #if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) 306 # define __attribute_format_strfmon__(a,b) \ 307 __attribute__ ((__format__ (__strfmon__, a, b))) 308 #else 309 # define __attribute_format_strfmon__(a,b) /* Ignore */ 310 #endif 311 312 /* The nonnull function attribute marks pointer parameters that 313 must not be NULL. Do not define __nonnull if it is already defined, 314 for portability when this file is used in Gnulib. */ 315 #ifndef __nonnull 316 # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) 317 # define __nonnull(params) __attribute__ ((__nonnull__ params)) 318 # else 319 # define __nonnull(params) 320 # endif 321 #endif 322 323 /* If fortification mode, we warn about unused results of certain 324 function calls which can lead to problems. */ 325 #if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) 326 # define __attribute_warn_unused_result__ \ 327 __attribute__ ((__warn_unused_result__)) 328 # if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 329 # define __wur __attribute_warn_unused_result__ 330 # endif 331 #else 332 # define __attribute_warn_unused_result__ /* empty */ 333 #endif 334 #ifndef __wur 335 # define __wur /* Ignore */ 336 #endif 337 338 /* Forces a function to be always inlined. */ 339 #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) 340 /* The Linux kernel defines __always_inline in stddef.h (283d7573), and 341 it conflicts with this definition. Therefore undefine it first to 342 allow either header to be included first. */ 343 # undef __always_inline 344 # define __always_inline __inline __attribute__ ((__always_inline__)) 345 #else 346 # undef __always_inline 347 # define __always_inline __inline 348 #endif 349 350 /* Associate error messages with the source location of the call site rather 351 than with the source location inside the function. */ 352 #if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) 353 # define __attribute_artificial__ __attribute__ ((__artificial__)) 354 #else 355 # define __attribute_artificial__ /* Ignore */ 356 #endif 357 358 /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 359 inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ 360 or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions 361 older than 4.3 may define these macros and still not guarantee GNU inlining 362 semantics. 363 364 clang++ identifies itself as gcc-4.2, but has support for GNU inlining 365 semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and 366 __GNUC_GNU_INLINE__ macro definitions. */ 367 #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ 368 || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ 369 || defined __GNUC_GNU_INLINE__))) 370 # if defined __GNUC_STDC_INLINE__ || defined __cplusplus 371 # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) 372 # define __extern_always_inline \ 373 extern __always_inline __attribute__ ((__gnu_inline__)) 374 # else 375 # define __extern_inline extern __inline 376 # define __extern_always_inline extern __always_inline 377 # endif 378 #endif 379 380 #ifdef __extern_always_inline 381 # define __fortify_function __extern_always_inline __attribute_artificial__ 382 #endif 383 384 /* GCC 4.3 and above allow passing all anonymous arguments of an 385 __extern_always_inline function to some other vararg function. */ 386 #if __GNUC_PREREQ (4,3) 387 # define __va_arg_pack() __builtin_va_arg_pack () 388 # define __va_arg_pack_len() __builtin_va_arg_pack_len () 389 #endif 390 391 /* It is possible to compile containing GCC extensions even if GCC is 392 run in pedantic mode if the uses are carefully marked using the 393 `__extension__' keyword. But this is not generally available before 394 version 2.8. */ 395 #if !(__GNUC_PREREQ (2,8) || defined __clang__) 396 # define __extension__ /* Ignore */ 397 #endif 398 399 /* __restrict is known in EGCS 1.2 and above, and in clang. 400 It works also in C++ mode (outside of arrays), but only when spelled 401 as '__restrict', not 'restrict'. */ 402 #if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) 403 # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 404 # define __restrict restrict 405 # else 406 # define __restrict /* Ignore */ 407 # endif 408 #endif 409 410 /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is 411 array_name[restrict] 412 GCC 3.1 and clang support this. 413 This syntax is not usable in C++ mode. */ 414 #if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus 415 # define __restrict_arr __restrict 416 #else 417 # ifdef __GNUC__ 418 # define __restrict_arr /* Not supported in old GCC. */ 419 # else 420 # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 421 # define __restrict_arr restrict 422 # else 423 /* Some other non-C99 compiler. */ 424 # define __restrict_arr /* Not supported. */ 425 # endif 426 # endif 427 #endif 428 429 #if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) 430 # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) 431 # define __glibc_likely(cond) __builtin_expect ((cond), 1) 432 #else 433 # define __glibc_unlikely(cond) (cond) 434 # define __glibc_likely(cond) (cond) 435 #endif 436 437 #if (!defined _Noreturn \ 438 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ 439 && !(__GNUC_PREREQ (4,7) \ 440 || (3 < __clang_major__ + (5 <= __clang_minor__)))) 441 # if __GNUC_PREREQ (2,8) 442 # define _Noreturn __attribute__ ((__noreturn__)) 443 # else 444 # define _Noreturn 445 # endif 446 #endif 447 448 #if __GNUC_PREREQ (8, 0) 449 /* Describes a char array whose address can safely be passed as the first 450 argument to strncpy and strncat, as the char array is not necessarily 451 a NUL-terminated string. */ 452 # define __attribute_nonstring__ __attribute__ ((__nonstring__)) 453 #else 454 # define __attribute_nonstring__ 455 #endif 456 457 /* Undefine (also defined in libc-symbols.h). */ 458 #undef __attribute_copy__ 459 #if __GNUC_PREREQ (9, 0) 460 /* Copies attributes from the declaration or type referenced by 461 the argument. */ 462 # define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) 463 #else 464 # define __attribute_copy__(arg) 465 #endif 466 467 #if (!defined _Static_assert && !defined __cplusplus \ 468 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ 469 && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ 470 || defined __STRICT_ANSI__)) 471 # define _Static_assert(expr, diagnostic) \ 472 extern int (*__Static_assert_function (void)) \ 473 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] 474 #endif 475 476 /* The #ifndef lets Gnulib avoid including these on non-glibc 477 platforms, where the includes typically do not exist. */ 478 #ifndef __WORDSIZE 479 # include <bits/wordsize.h> 480 # include <bits/long-double.h> 481 #endif 482 483 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 484 # ifdef __REDIRECT 485 486 /* Alias name defined automatically. */ 487 # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir 488 # define __LDBL_REDIR_DECL(name) \ 489 extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); 490 491 /* Alias name defined automatically, with leading underscores. */ 492 # define __LDBL_REDIR2_DECL(name) \ 493 extern __typeof (__##name) __##name \ 494 __asm (__ASMNAME ("__" #name "ieee128")); 495 496 /* Alias name defined manually. */ 497 # define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 498 # define __LDBL_REDIR1_DECL(name, alias) \ 499 extern __typeof (name) name __asm (__ASMNAME (#alias)); 500 501 # define __LDBL_REDIR1_NTH(name, proto, alias) \ 502 __REDIRECT_NTH (name, proto, alias) 503 # define __REDIRECT_NTH_LDBL(name, proto, alias) \ 504 __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) 505 506 /* Unused. */ 507 # define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl 508 # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth 509 510 # else 511 _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); 512 # endif 513 #elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH 514 # define __LDBL_COMPAT 1 515 # ifdef __REDIRECT 516 # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) 517 # define __LDBL_REDIR(name, proto) \ 518 __LDBL_REDIR1 (name, proto, __nldbl_##name) 519 # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) 520 # define __LDBL_REDIR_NTH(name, proto) \ 521 __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) 522 # define __LDBL_REDIR2_DECL(name) \ 523 extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); 524 # define __LDBL_REDIR1_DECL(name, alias) \ 525 extern __typeof (name) name __asm (__ASMNAME (#alias)); 526 # define __LDBL_REDIR_DECL(name) \ 527 extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); 528 # define __REDIRECT_LDBL(name, proto, alias) \ 529 __LDBL_REDIR1 (name, proto, __nldbl_##alias) 530 # define __REDIRECT_NTH_LDBL(name, proto, alias) \ 531 __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) 532 # endif 533 #endif 534 #if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ 535 || !defined __REDIRECT 536 # define __LDBL_REDIR1(name, proto, alias) name proto 537 # define __LDBL_REDIR(name, proto) name proto 538 # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW 539 # define __LDBL_REDIR_NTH(name, proto) name proto __THROW 540 # define __LDBL_REDIR2_DECL(name) 541 # define __LDBL_REDIR_DECL(name) 542 # ifdef __REDIRECT 543 # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) 544 # define __REDIRECT_NTH_LDBL(name, proto, alias) \ 545 __REDIRECT_NTH (name, proto, alias) 546 # endif 547 #endif 548 549 /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is 550 intended for use in preprocessor macros. 551 552 Note: MESSAGE must be a _single_ string; concatenation of string 553 literals is not supported. */ 554 #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) 555 # define __glibc_macro_warning1(message) _Pragma (#message) 556 # define __glibc_macro_warning(message) \ 557 __glibc_macro_warning1 (GCC warning message) 558 #else 559 # define __glibc_macro_warning(msg) 560 #endif 561 562 /* Generic selection (ISO C11) is a C-only feature, available in GCC 563 since version 4.9. Previous versions do not provide generic 564 selection, even though they might set __STDC_VERSION__ to 201112L, 565 when in -std=c11 mode. Thus, we must check for !defined __GNUC__ 566 when testing __STDC_VERSION__ for generic selection support. 567 On the other hand, Clang also defines __GNUC__, so a clang-specific 568 check is required to enable the use of generic selection. */ 569 #if !defined __cplusplus \ 570 && (__GNUC_PREREQ (4, 9) \ 571 || __glibc_has_extension (c_generic_selections) \ 572 || (!defined __GNUC__ && defined __STDC_VERSION__ \ 573 && __STDC_VERSION__ >= 201112L)) 574 # define __HAVE_GENERIC_SELECTION 1 575 #else 576 # define __HAVE_GENERIC_SELECTION 0 577 #endif 578 579 #if __GNUC_PREREQ (10, 0) 580 /* Designates a 1-based positional argument ref-index of pointer type 581 that can be used to access size-index elements of the pointed-to 582 array according to access mode, or at least one element when 583 size-index is not provided: 584 access (access-mode, <ref-index> [, <size-index>]) */ 585 #define __attr_access(x) __attribute__ ((__access__ x)) 586 #else 587 # define __attr_access(x) 588 #endif 589 590 /* Specify that a function such as setjmp or vfork may return 591 twice. */ 592 #if __GNUC_PREREQ (4, 1) 593 # define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) 594 #else 595 # define __attribute_returns_twice__ /* Ignore. */ 596 #endif 597 598 #endif /* sys/cdefs.h */ 599