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