modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/arm-linux-gnueabihf/sys/cdefs.h (about) 1 /* Copyright (C) 1992-2016 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 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. 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 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://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 anymore supported. */ 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 #ifdef __GNUC__ 38 39 /* All functions, except those with callbacks or those that 40 synchronize memory, are leaf functions. */ 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 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 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. */ 54 #if !defined __cplusplus && __GNUC_PREREQ (3, 3) 55 #define __THROW __attribute__ ((__nothrow__ __LEAF)) 56 #define __THROWNL __attribute__ ((__nothrow__)) 57 #define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct 58 #else 59 #if defined __cplusplus && __GNUC_PREREQ (2,8) 60 #define __THROW throw () 61 #define __THROWNL throw () 62 #define __NTH(fct) __LEAF_ATTR fct throw () 63 #else 64 #define __THROW 65 #define __THROWNL 66 #define __NTH(fct) fct 67 #endif 68 #endif 69 70 #else /* Not GCC. */ 71 72 #define __inline /* No inline functions. */ 73 74 #define __THROW 75 #define __THROWNL 76 #define __NTH(fct) fct 77 78 #endif /* GCC. */ 79 80 /* These two macros are not used in glibc anymore. They are kept here 81 only because some other projects expect the macros to be defined. */ 82 #define __P(args) args 83 #define __PMT(args) args 84 85 /* For these things, GCC behaves the ANSI way normally, 86 and the non-ANSI way under -traditional. */ 87 88 #define __CONCAT(x,y) x ## y 89 #define __STRING(x) #x 90 91 /* This is not a typedef so `const __ptr_t' does the right thing. */ 92 #define __ptr_t void * 93 #define __long_double_t long double 94 95 /* C++ needs to know that types and declarations are C, not C++. */ 96 #ifdef __cplusplus 97 #define __BEGIN_DECLS extern "C" { 98 #define __END_DECLS } 99 #else 100 #define __BEGIN_DECLS 101 #define __END_DECLS 102 #endif 103 104 /* The standard library needs the functions from the ISO C90 standard 105 in the std namespace. At the same time we want to be safe for 106 future changes and we include the ISO C99 code in the non-standard 107 namespace __c99. The C++ wrapper header take case of adding the 108 definitions to the global namespace. */ 109 #if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES 110 #define __BEGIN_NAMESPACE_STD namespace std { 111 #define __END_NAMESPACE_STD } 112 #define __USING_NAMESPACE_STD(name) using std::name; 113 #define __BEGIN_NAMESPACE_C99 namespace __c99 { 114 #define __END_NAMESPACE_C99 } 115 #define __USING_NAMESPACE_C99(name) using __c99::name; 116 #else 117 /* For compatibility we do not add the declarations into any 118 namespace. They will end up in the global namespace which is what 119 old code expects. */ 120 #define __BEGIN_NAMESPACE_STD 121 #define __END_NAMESPACE_STD 122 #define __USING_NAMESPACE_STD(name) 123 #define __BEGIN_NAMESPACE_C99 124 #define __END_NAMESPACE_C99 125 #define __USING_NAMESPACE_C99(name) 126 #endif 127 128 /* Fortify support. */ 129 #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) 130 #define __bos0(ptr) __builtin_object_size (ptr, 0) 131 132 #if __GNUC_PREREQ (4,3) 133 #define __warndecl(name, msg) \ 134 extern void name (void) __attribute__((__warning__ (msg))) 135 #define __warnattr(msg) __attribute__((__warning__ (msg))) 136 #define __errordecl(name, msg) \ 137 extern void name (void) __attribute__((__error__ (msg))) 138 #else 139 #define __warndecl(name, msg) extern void name (void) 140 #define __warnattr(msg) 141 #define __errordecl(name, msg) extern void name (void) 142 #endif 143 144 /* Support for flexible arrays. */ 145 #if __GNUC_PREREQ (2,97) 146 /* GCC 2.97 supports C99 flexible array members. */ 147 #define __flexarr [] 148 #else 149 #ifdef __GNUC__ 150 #define __flexarr [0] 151 #else 152 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 153 #define __flexarr [] 154 #else 155 /* Some other non-C99 compiler. Approximate with [1]. */ 156 #define __flexarr [1] 157 #endif 158 #endif 159 #endif 160 161 /* __asm__ ("xyz") is used throughout the headers to rename functions 162 at the assembly language level. This is wrapped by the __REDIRECT 163 macro, in order to support compilers that can do this some other 164 way. When compilers don't support asm-names at all, we have to do 165 preprocessor tricks instead (which don't have exactly the right 166 semantics, but it's the best we can do). 167 168 Example: 169 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ 170 171 #if defined __GNUC__ && __GNUC__ >= 2 172 173 #define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) 174 #ifdef __cplusplus 175 #define __REDIRECT_NTH(name, proto, alias) \ 176 name proto __THROW __asm__ (__ASMNAME (#alias)) 177 #define __REDIRECT_NTHNL(name, proto, alias) \ 178 name proto __THROWNL __asm__ (__ASMNAME (#alias)) 179 #else 180 #define __REDIRECT_NTH(name, proto, alias) \ 181 name proto __asm__ (__ASMNAME (#alias)) __THROW 182 #define __REDIRECT_NTHNL(name, proto, alias) \ 183 name proto __asm__ (__ASMNAME (#alias)) __THROWNL 184 #endif 185 #define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) 186 #define __ASMNAME2(prefix, cname) __STRING (prefix) cname 187 188 /* 189 #elif __SOME_OTHER_COMPILER__ 190 191 # define __REDIRECT(name, proto, alias) name proto; \ 192 _Pragma("let " #name " = " #alias) 193 */ 194 #endif 195 196 /* GCC has various useful declarations that can be made with the 197 `__attribute__' syntax. All of the ways we use this do fine if 198 they are omitted for compilers that don't understand it. */ 199 #if !defined __GNUC__ || __GNUC__ < 2 200 #define __attribute__(xyz) /* Ignore */ 201 #endif 202 203 /* At some point during the gcc 2.96 development the `malloc' attribute 204 for functions was introduced. We don't want to use it unconditionally 205 (although this would be possible) since it generates warnings. */ 206 #if __GNUC_PREREQ (2,96) 207 #define __attribute_malloc__ __attribute__ ((__malloc__)) 208 #else 209 #define __attribute_malloc__ /* Ignore */ 210 #endif 211 212 /* Tell the compiler which arguments to an allocation function 213 indicate the size of the allocation. */ 214 #if __GNUC_PREREQ (4, 3) 215 #define __attribute_alloc_size__(params) \ 216 __attribute__ ((__alloc_size__ params)) 217 #else 218 #define __attribute_alloc_size__(params) /* Ignore. */ 219 #endif 220 221 /* At some point during the gcc 2.96 development the `pure' attribute 222 for functions was introduced. We don't want to use it unconditionally 223 (although this would be possible) since it generates warnings. */ 224 #if __GNUC_PREREQ (2,96) 225 #define __attribute_pure__ __attribute__ ((__pure__)) 226 #else 227 #define __attribute_pure__ /* Ignore */ 228 #endif 229 230 /* This declaration tells the compiler that the value is constant. */ 231 #if __GNUC_PREREQ (2,5) 232 #define __attribute_const__ __attribute__ ((__const__)) 233 #else 234 #define __attribute_const__ /* Ignore */ 235 #endif 236 237 /* At some point during the gcc 3.1 development the `used' attribute 238 for functions was introduced. We don't want to use it unconditionally 239 (although this would be possible) since it generates warnings. */ 240 #if __GNUC_PREREQ (3,1) 241 #define __attribute_used__ __attribute__ ((__used__)) 242 #define __attribute_noinline__ __attribute__ ((__noinline__)) 243 #else 244 #define __attribute_used__ __attribute__ ((__unused__)) 245 #define __attribute_noinline__ /* Ignore */ 246 #endif 247 248 /* gcc allows marking deprecated functions. */ 249 #if __GNUC_PREREQ (3,2) 250 #define __attribute_deprecated__ __attribute__ ((__deprecated__)) 251 #else 252 #define __attribute_deprecated__ /* Ignore */ 253 #endif 254 255 /* At some point during the gcc 2.8 development the `format_arg' attribute 256 for functions was introduced. We don't want to use it unconditionally 257 (although this would be possible) since it generates warnings. 258 If several `format_arg' attributes are given for the same function, in 259 gcc-3.0 and older, all but the last one are ignored. In newer gccs, 260 all designated arguments are considered. */ 261 #if __GNUC_PREREQ (2,8) 262 #define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) 263 #else 264 #define __attribute_format_arg__(x) /* Ignore */ 265 #endif 266 267 /* At some point during the gcc 2.97 development the `strfmon' format 268 attribute for functions was introduced. We don't want to use it 269 unconditionally (although this would be possible) since it 270 generates warnings. */ 271 #if __GNUC_PREREQ (2,97) 272 #define __attribute_format_strfmon__(a,b) \ 273 __attribute__ ((__format__ (__strfmon__, a, b))) 274 #else 275 #define __attribute_format_strfmon__(a,b) /* Ignore */ 276 #endif 277 278 /* The nonull function attribute allows to mark pointer parameters which 279 must not be NULL. */ 280 #if __GNUC_PREREQ (3,3) 281 #define __nonnull(params) __attribute__ ((__nonnull__ params)) 282 #else 283 #define __nonnull(params) 284 #endif 285 286 /* If fortification mode, we warn about unused results of certain 287 function calls which can lead to problems. */ 288 #if __GNUC_PREREQ (3,4) 289 #define __attribute_warn_unused_result__ \ 290 __attribute__ ((__warn_unused_result__)) 291 #if __USE_FORTIFY_LEVEL > 0 292 #define __wur __attribute_warn_unused_result__ 293 #endif 294 #else 295 #define __attribute_warn_unused_result__ /* empty */ 296 #endif 297 #ifndef __wur 298 #define __wur /* Ignore */ 299 #endif 300 301 /* Forces a function to be always inlined. */ 302 #if __GNUC_PREREQ (3,2) 303 /* The Linux kernel defines __always_inline in stddef.h (283d7573), and 304 it conflicts with this definition. Therefore undefine it first to 305 allow either header to be included first. */ 306 #undef __always_inline 307 #define __always_inline __inline __attribute__ ((__always_inline__)) 308 #else 309 #undef __always_inline 310 #define __always_inline __inline 311 #endif 312 313 /* Associate error messages with the source location of the call site rather 314 than with the source location inside the function. */ 315 #if __GNUC_PREREQ (4,3) 316 #define __attribute_artificial__ __attribute__ ((__artificial__)) 317 #else 318 #define __attribute_artificial__ /* Ignore */ 319 #endif 320 321 /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 322 inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ 323 or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions 324 older than 4.3 may define these macros and still not guarantee GNU inlining 325 semantics. 326 327 clang++ identifies itself as gcc-4.2, but has support for GNU inlining 328 semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and 329 __GNUC_GNU_INLINE__ macro definitions. */ 330 #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ 331 || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ 332 || defined __GNUC_GNU_INLINE__))) 333 #if defined __GNUC_STDC_INLINE__ || defined __cplusplus 334 #define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) 335 #define __extern_always_inline \ 336 extern __always_inline __attribute__ ((__gnu_inline__)) 337 #else 338 #define __extern_inline extern __inline 339 #define __extern_always_inline extern __always_inline 340 #endif 341 #endif 342 343 #ifdef __extern_always_inline 344 #define __fortify_function __extern_always_inline __attribute_artificial__ 345 #endif 346 347 /* GCC 4.3 and above allow passing all anonymous arguments of an 348 __extern_always_inline function to some other vararg function. */ 349 #if __GNUC_PREREQ (4,3) 350 #define __va_arg_pack() __builtin_va_arg_pack () 351 #define __va_arg_pack_len() __builtin_va_arg_pack_len () 352 #endif 353 354 /* It is possible to compile containing GCC extensions even if GCC is 355 run in pedantic mode if the uses are carefully marked using the 356 `__extension__' keyword. But this is not generally available before 357 version 2.8. */ 358 #if !__GNUC_PREREQ (2,8) 359 #define __extension__ /* Ignore */ 360 #endif 361 362 /* __restrict is known in EGCS 1.2 and above. */ 363 #if !__GNUC_PREREQ (2,92) 364 #define __restrict /* Ignore */ 365 #endif 366 367 /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is 368 array_name[restrict] 369 GCC 3.1 supports this. */ 370 #if __GNUC_PREREQ (3,1) && !defined __GNUG__ 371 #define __restrict_arr __restrict 372 #else 373 #ifdef __GNUC__ 374 #define __restrict_arr /* Not supported in old GCC. */ 375 #else 376 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 377 #define __restrict_arr restrict 378 #else 379 /* Some other non-C99 compiler. */ 380 #define __restrict_arr /* Not supported. */ 381 #endif 382 #endif 383 #endif 384 385 #if __GNUC__ >= 3 386 #define __glibc_unlikely(cond) __builtin_expect ((cond), 0) 387 #define __glibc_likely(cond) __builtin_expect ((cond), 1) 388 #else 389 #define __glibc_unlikely(cond) (cond) 390 #define __glibc_likely(cond) (cond) 391 #endif 392 393 #if (!defined _Noreturn \ 394 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ 395 && !__GNUC_PREREQ (4,7)) 396 #if __GNUC_PREREQ (2,8) 397 #define _Noreturn __attribute__ ((__noreturn__)) 398 #else 399 #define _Noreturn 400 #endif 401 #endif 402 403 #if (!defined _Static_assert && !defined __cplusplus \ 404 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ 405 && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) 406 #define _Static_assert(expr, diagnostic) \ 407 extern int (*__Static_assert_function (void)) \ 408 [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] 409 #endif 410 411 #include <bits/wordsize.h> 412 413 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH 414 #define __LDBL_COMPAT 1 415 #ifdef __REDIRECT 416 #define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) 417 #define __LDBL_REDIR(name, proto) \ 418 __LDBL_REDIR1 (name, proto, __nldbl_##name) 419 #define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) 420 #define __LDBL_REDIR_NTH(name, proto) \ 421 __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) 422 #define __LDBL_REDIR1_DECL(name, alias) \ 423 extern __typeof (name) name __asm (__ASMNAME (#alias)); 424 #define __LDBL_REDIR_DECL(name) \ 425 extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); 426 #define __REDIRECT_LDBL(name, proto, alias) \ 427 __LDBL_REDIR1 (name, proto, __nldbl_##alias) 428 #define __REDIRECT_NTH_LDBL(name, proto, alias) \ 429 __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) 430 #endif 431 #endif 432 #if !defined __LDBL_COMPAT || !defined __REDIRECT 433 #define __LDBL_REDIR1(name, proto, alias) name proto 434 #define __LDBL_REDIR(name, proto) name proto 435 #define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW 436 #define __LDBL_REDIR_NTH(name, proto) name proto __THROW 437 #define __LDBL_REDIR_DECL(name) 438 #ifdef __REDIRECT 439 #define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) 440 #define __REDIRECT_NTH_LDBL(name, proto, alias) \ 441 __REDIRECT_NTH (name, proto, alias) 442 #endif 443 #endif 444 445 #endif /* sys/cdefs.h */