| 1 | /* Copyright (C) 1992-2014 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 |  | 
| 96 | /* C++ needs to know that types and declarations are C, not C++.  */ | 
| 97 | #ifdef	__cplusplus | 
| 98 | # define __BEGIN_DECLS	extern "C" { | 
| 99 | # define __END_DECLS	} | 
| 100 | #else | 
| 101 | # define __BEGIN_DECLS | 
| 102 | # define __END_DECLS | 
| 103 | #endif | 
| 104 |  | 
| 105 |  | 
| 106 | /* The standard library needs the functions from the ISO C90 standard | 
| 107 |    in the std namespace.  At the same time we want to be safe for | 
| 108 |    future changes and we include the ISO C99 code in the non-standard | 
| 109 |    namespace __c99.  The C++ wrapper header take case of adding the | 
| 110 |    definitions to the global namespace.  */ | 
| 111 | #if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES | 
| 112 | # define __BEGIN_NAMESPACE_STD	namespace std { | 
| 113 | # define __END_NAMESPACE_STD	} | 
| 114 | # define __USING_NAMESPACE_STD(name) using std::name; | 
| 115 | # define __BEGIN_NAMESPACE_C99	namespace __c99 { | 
| 116 | # define __END_NAMESPACE_C99	} | 
| 117 | # define __USING_NAMESPACE_C99(name) using __c99::name; | 
| 118 | #else | 
| 119 | /* For compatibility we do not add the declarations into any | 
| 120 |    namespace.  They will end up in the global namespace which is what | 
| 121 |    old code expects.  */ | 
| 122 | # define __BEGIN_NAMESPACE_STD | 
| 123 | # define __END_NAMESPACE_STD | 
| 124 | # define __USING_NAMESPACE_STD(name) | 
| 125 | # define __BEGIN_NAMESPACE_C99 | 
| 126 | # define __END_NAMESPACE_C99 | 
| 127 | # define __USING_NAMESPACE_C99(name) | 
| 128 | #endif | 
| 129 |  | 
| 130 |  | 
| 131 | /* Fortify support.  */ | 
| 132 | #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) | 
| 133 | #define __bos0(ptr) __builtin_object_size (ptr, 0) | 
| 134 | #define __fortify_function __extern_always_inline __attribute_artificial__ | 
| 135 |  | 
| 136 | #if __GNUC_PREREQ (4,3) | 
| 137 | # define __warndecl(name, msg) \ | 
| 138 |   extern void name (void) __attribute__((__warning__ (msg))) | 
| 139 | # define __warnattr(msg) __attribute__((__warning__ (msg))) | 
| 140 | # define __errordecl(name, msg) \ | 
| 141 |   extern void name (void) __attribute__((__error__ (msg))) | 
| 142 | #else | 
| 143 | # define __warndecl(name, msg) extern void name (void) | 
| 144 | # define __warnattr(msg) | 
| 145 | # define __errordecl(name, msg) extern void name (void) | 
| 146 | #endif | 
| 147 |  | 
| 148 | /* Support for flexible arrays.  */ | 
| 149 | #if __GNUC_PREREQ (2,97) | 
| 150 | /* GCC 2.97 supports C99 flexible array members.  */ | 
| 151 | # define __flexarr	[] | 
| 152 | #else | 
| 153 | # ifdef __GNUC__ | 
| 154 | #  define __flexarr	[0] | 
| 155 | # else | 
| 156 | #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | 
| 157 | #   define __flexarr	[] | 
| 158 | #  else | 
| 159 | /* Some other non-C99 compiler.  Approximate with [1].  */ | 
| 160 | #   define __flexarr	[1] | 
| 161 | #  endif | 
| 162 | # endif | 
| 163 | #endif | 
| 164 |  | 
| 165 |  | 
| 166 | /* __asm__ ("xyz") is used throughout the headers to rename functions | 
| 167 |    at the assembly language level.  This is wrapped by the __REDIRECT | 
| 168 |    macro, in order to support compilers that can do this some other | 
| 169 |    way.  When compilers don't support asm-names at all, we have to do | 
| 170 |    preprocessor tricks instead (which don't have exactly the right | 
| 171 |    semantics, but it's the best we can do). | 
| 172 |  | 
| 173 |    Example: | 
| 174 |    int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ | 
| 175 |  | 
| 176 | #if defined __GNUC__ && __GNUC__ >= 2 | 
| 177 |  | 
| 178 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) | 
| 179 | # ifdef __cplusplus | 
| 180 | #  define __REDIRECT_NTH(name, proto, alias) \ | 
| 181 |      name proto __THROW __asm__ (__ASMNAME (#alias)) | 
| 182 | #  define __REDIRECT_NTHNL(name, proto, alias) \ | 
| 183 |      name proto __THROWNL __asm__ (__ASMNAME (#alias)) | 
| 184 | # else | 
| 185 | #  define __REDIRECT_NTH(name, proto, alias) \ | 
| 186 |      name proto __asm__ (__ASMNAME (#alias)) __THROW | 
| 187 | #  define __REDIRECT_NTHNL(name, proto, alias) \ | 
| 188 |      name proto __asm__ (__ASMNAME (#alias)) __THROWNL | 
| 189 | # endif | 
| 190 | # define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname) | 
| 191 | # define __ASMNAME2(prefix, cname) __STRING (prefix) cname | 
| 192 |  | 
| 193 | /* | 
| 194 | #elif __SOME_OTHER_COMPILER__ | 
| 195 |  | 
| 196 | # define __REDIRECT(name, proto, alias) name proto; \ | 
| 197 | 	_Pragma("let " #name " = " #alias) | 
| 198 | */ | 
| 199 | #endif | 
| 200 |  | 
| 201 | /* GCC has various useful declarations that can be made with the | 
| 202 |    `__attribute__' syntax.  All of the ways we use this do fine if | 
| 203 |    they are omitted for compilers that don't understand it. */ | 
| 204 | #if !defined __GNUC__ || __GNUC__ < 2 | 
| 205 | # define __attribute__(xyz)	/* Ignore */ | 
| 206 | #endif | 
| 207 |  | 
| 208 | /* At some point during the gcc 2.96 development the `malloc' attribute | 
| 209 |    for functions was introduced.  We don't want to use it unconditionally | 
| 210 |    (although this would be possible) since it generates warnings.  */ | 
| 211 | #if __GNUC_PREREQ (2,96) | 
| 212 | # define __attribute_malloc__ __attribute__ ((__malloc__)) | 
| 213 | #else | 
| 214 | # define __attribute_malloc__ /* Ignore */ | 
| 215 | #endif | 
| 216 |  | 
| 217 | /* Tell the compiler which arguments to an allocation function | 
| 218 |    indicate the size of the allocation.  */ | 
| 219 | #if __GNUC_PREREQ (4, 3) | 
| 220 | # define __attribute_alloc_size__(params) \ | 
| 221 |   __attribute__ ((__alloc_size__ params)) | 
| 222 | #else | 
| 223 | # define __attribute_alloc_size__(params) /* Ignore.  */ | 
| 224 | #endif | 
| 225 |  | 
| 226 | /* At some point during the gcc 2.96 development the `pure' 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) | 
| 230 | # define __attribute_pure__ __attribute__ ((__pure__)) | 
| 231 | #else | 
| 232 | # define __attribute_pure__ /* Ignore */ | 
| 233 | #endif | 
| 234 |  | 
| 235 | /* This declaration tells the compiler that the value is constant.  */ | 
| 236 | #if __GNUC_PREREQ (2,5) | 
| 237 | # define __attribute_const__ __attribute__ ((__const__)) | 
| 238 | #else | 
| 239 | # define __attribute_const__ /* Ignore */ | 
| 240 | #endif | 
| 241 |  | 
| 242 | /* At some point during the gcc 3.1 development the `used' attribute | 
| 243 |    for functions was introduced.  We don't want to use it unconditionally | 
| 244 |    (although this would be possible) since it generates warnings.  */ | 
| 245 | #if __GNUC_PREREQ (3,1) | 
| 246 | # define __attribute_used__ __attribute__ ((__used__)) | 
| 247 | # define __attribute_noinline__ __attribute__ ((__noinline__)) | 
| 248 | #else | 
| 249 | # define __attribute_used__ __attribute__ ((__unused__)) | 
| 250 | # define __attribute_noinline__ /* Ignore */ | 
| 251 | #endif | 
| 252 |  | 
| 253 | /* gcc allows marking deprecated functions.  */ | 
| 254 | #if __GNUC_PREREQ (3,2) | 
| 255 | # define __attribute_deprecated__ __attribute__ ((__deprecated__)) | 
| 256 | #else | 
| 257 | # define __attribute_deprecated__ /* Ignore */ | 
| 258 | #endif | 
| 259 |  | 
| 260 | /* At some point during the gcc 2.8 development the `format_arg' 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 several `format_arg' attributes are given for the same function, in | 
| 264 |    gcc-3.0 and older, all but the last one are ignored.  In newer gccs, | 
| 265 |    all designated arguments are considered.  */ | 
| 266 | #if __GNUC_PREREQ (2,8) | 
| 267 | # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) | 
| 268 | #else | 
| 269 | # define __attribute_format_arg__(x) /* Ignore */ | 
| 270 | #endif | 
| 271 |  | 
| 272 | /* At some point during the gcc 2.97 development the `strfmon' format | 
| 273 |    attribute for functions was introduced.  We don't want to use it | 
| 274 |    unconditionally (although this would be possible) since it | 
| 275 |    generates warnings.  */ | 
| 276 | #if __GNUC_PREREQ (2,97) | 
| 277 | # define __attribute_format_strfmon__(a,b) \ | 
| 278 |   __attribute__ ((__format__ (__strfmon__, a, b))) | 
| 279 | #else | 
| 280 | # define __attribute_format_strfmon__(a,b) /* Ignore */ | 
| 281 | #endif | 
| 282 |  | 
| 283 | /* The nonull function attribute allows to mark pointer parameters which | 
| 284 |    must not be NULL.  */ | 
| 285 | #if __GNUC_PREREQ (3,3) | 
| 286 | # define __nonnull(params) __attribute__ ((__nonnull__ params)) | 
| 287 | #else | 
| 288 | # define __nonnull(params) | 
| 289 | #endif | 
| 290 |  | 
| 291 | /* If fortification mode, we warn about unused results of certain | 
| 292 |    function calls which can lead to problems.  */ | 
| 293 | #if __GNUC_PREREQ (3,4) | 
| 294 | # define __attribute_warn_unused_result__ \ | 
| 295 |    __attribute__ ((__warn_unused_result__)) | 
| 296 | # if __USE_FORTIFY_LEVEL > 0 | 
| 297 | #  define __wur __attribute_warn_unused_result__ | 
| 298 | # endif | 
| 299 | #else | 
| 300 | # define __attribute_warn_unused_result__ /* empty */ | 
| 301 | #endif | 
| 302 | #ifndef __wur | 
| 303 | # define __wur /* Ignore */ | 
| 304 | #endif | 
| 305 |  | 
| 306 | /* Forces a function to be always inlined.  */ | 
| 307 | #if __GNUC_PREREQ (3,2) | 
| 308 | # define __always_inline __inline __attribute__ ((__always_inline__)) | 
| 309 | #else | 
| 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 | #ifdef __GNUC__ | 
| 322 | /* One of these will be defined if the __gnu_inline__ attribute is | 
| 323 |    available.  In C++, __GNUC_GNU_INLINE__ will be defined even though | 
| 324 |    __inline does not use the GNU inlining rules.  If neither macro is | 
| 325 |    defined, this version of GCC only supports GNU inline semantics. */ | 
| 326 | # if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ | 
| 327 | #  define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) | 
| 328 | #  define __extern_always_inline \ | 
| 329 |   extern __always_inline __attribute__ ((__gnu_inline__)) | 
| 330 | # else | 
| 331 | #  define __extern_inline extern __inline | 
| 332 | #  define __extern_always_inline extern __always_inline | 
| 333 | # endif | 
| 334 | #else /* Not GCC.  */ | 
| 335 | # define __extern_inline  /* Ignore */ | 
| 336 | # define __extern_always_inline /* Ignore */ | 
| 337 | #endif | 
| 338 |  | 
| 339 | /* GCC 4.3 and above allow passing all anonymous arguments of an | 
| 340 |    __extern_always_inline function to some other vararg function.  */ | 
| 341 | #if __GNUC_PREREQ (4,3) | 
| 342 | # define __va_arg_pack() __builtin_va_arg_pack () | 
| 343 | # define __va_arg_pack_len() __builtin_va_arg_pack_len () | 
| 344 | #endif | 
| 345 |  | 
| 346 | /* It is possible to compile containing GCC extensions even if GCC is | 
| 347 |    run in pedantic mode if the uses are carefully marked using the | 
| 348 |    `__extension__' keyword.  But this is not generally available before | 
| 349 |    version 2.8.  */ | 
| 350 | #if !__GNUC_PREREQ (2,8) | 
| 351 | # define __extension__		/* Ignore */ | 
| 352 | #endif | 
| 353 |  | 
| 354 | /* __restrict is known in EGCS 1.2 and above. */ | 
| 355 | #if !__GNUC_PREREQ (2,92) | 
| 356 | # define __restrict	/* Ignore */ | 
| 357 | #endif | 
| 358 |  | 
| 359 | /* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is | 
| 360 |      array_name[restrict] | 
| 361 |    GCC 3.1 supports this.  */ | 
| 362 | #if __GNUC_PREREQ (3,1) && !defined __GNUG__ | 
| 363 | # define __restrict_arr	__restrict | 
| 364 | #else | 
| 365 | # ifdef __GNUC__ | 
| 366 | #  define __restrict_arr	/* Not supported in old GCC.  */ | 
| 367 | # else | 
| 368 | #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | 
| 369 | #   define __restrict_arr	restrict | 
| 370 | #  else | 
| 371 | /* Some other non-C99 compiler.  */ | 
| 372 | #   define __restrict_arr	/* Not supported.  */ | 
| 373 | #  endif | 
| 374 | # endif | 
| 375 | #endif | 
| 376 |  | 
| 377 | #if __GNUC__ >= 3 | 
| 378 | # define __glibc_unlikely(cond)	__builtin_expect ((cond), 0) | 
| 379 | # define __glibc_likely(cond)	__builtin_expect ((cond), 1) | 
| 380 | #else | 
| 381 | # define __glibc_unlikely(cond)	(cond) | 
| 382 | # define __glibc_likely(cond)	(cond) | 
| 383 | #endif | 
| 384 |  | 
| 385 | #include <bits/wordsize.h> | 
| 386 |  | 
| 387 | #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH | 
| 388 | # define __LDBL_COMPAT 1 | 
| 389 | # ifdef __REDIRECT | 
| 390 | #  define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) | 
| 391 | #  define __LDBL_REDIR(name, proto) \ | 
| 392 |   __LDBL_REDIR1 (name, proto, __nldbl_##name) | 
| 393 | #  define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) | 
| 394 | #  define __LDBL_REDIR_NTH(name, proto) \ | 
| 395 |   __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) | 
| 396 | #  define __LDBL_REDIR1_DECL(name, alias) \ | 
| 397 |   extern __typeof (name) name __asm (__ASMNAME (#alias)); | 
| 398 | #  define __LDBL_REDIR_DECL(name) \ | 
| 399 |   extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); | 
| 400 | #  define __REDIRECT_LDBL(name, proto, alias) \ | 
| 401 |   __LDBL_REDIR1 (name, proto, __nldbl_##alias) | 
| 402 | #  define __REDIRECT_NTH_LDBL(name, proto, alias) \ | 
| 403 |   __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) | 
| 404 | # endif | 
| 405 | #endif | 
| 406 | #if !defined __LDBL_COMPAT || !defined __REDIRECT | 
| 407 | # define __LDBL_REDIR1(name, proto, alias) name proto | 
| 408 | # define __LDBL_REDIR(name, proto) name proto | 
| 409 | # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW | 
| 410 | # define __LDBL_REDIR_NTH(name, proto) name proto __THROW | 
| 411 | # define __LDBL_REDIR_DECL(name) | 
| 412 | # ifdef __REDIRECT | 
| 413 | #  define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) | 
| 414 | #  define __REDIRECT_NTH_LDBL(name, proto, alias) \ | 
| 415 |   __REDIRECT_NTH (name, proto, alias) | 
| 416 | # endif | 
| 417 | #endif | 
| 418 |  | 
| 419 | #endif	 /* sys/cdefs.h */ | 
| 420 |  |