modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/i386-linux-gnu/sys/cdefs.h (about)

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