|
Packit |
6c4009 |
/* Copyright (C) 1992-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _SYS_CDEFS_H
|
|
Packit |
6c4009 |
#define _SYS_CDEFS_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* We are almost always included from features.h. */
|
|
Packit |
6c4009 |
#ifndef _FEATURES_H
|
|
Packit |
6c4009 |
# include <features.h>
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The GNU libc does not support any K&R compilers or the traditional mode
|
|
Packit |
6c4009 |
of ISO C compilers anymore. Check for some of the combinations not
|
|
Packit |
6c4009 |
anymore supported. */
|
|
Packit |
6c4009 |
#if defined __GNUC__ && !defined __STDC__
|
|
Packit |
6c4009 |
# error "You need a ISO C conforming compiler to use the glibc headers"
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Some user header file might have defined this before. */
|
|
Packit |
6c4009 |
#undef __P
|
|
Packit |
6c4009 |
#undef __PMT
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __GNUC__
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* All functions, except those with callbacks or those that
|
|
Packit |
6c4009 |
synchronize memory, are leaf functions. */
|
|
Packit |
6c4009 |
# if __GNUC_PREREQ (4, 6) && !defined _LIBC
|
|
Packit |
6c4009 |
# define __LEAF , __leaf__
|
|
Packit |
6c4009 |
# define __LEAF_ATTR __attribute__ ((__leaf__))
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __LEAF
|
|
Packit |
6c4009 |
# define __LEAF_ATTR
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* GCC can always grok prototypes. For C++ programs we add throw()
|
|
Packit |
6c4009 |
to help it optimize the function calls. But this works only with
|
|
Packit |
6c4009 |
gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
|
|
Packit |
6c4009 |
as non-throwing using a function attribute since programs can use
|
|
Packit |
6c4009 |
the -fexceptions options for C code as well. */
|
|
Packit |
6c4009 |
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
|
|
Packit |
6c4009 |
# define __THROW __attribute__ ((__nothrow__ __LEAF))
|
|
Packit |
6c4009 |
# define __THROWNL __attribute__ ((__nothrow__))
|
|
Packit |
6c4009 |
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
|
|
Packit |
6c4009 |
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
|
Packit |
6c4009 |
# define __THROW throw ()
|
|
Packit |
6c4009 |
# define __THROWNL throw ()
|
|
Packit |
6c4009 |
# define __NTH(fct) __LEAF_ATTR fct throw ()
|
|
Packit |
6c4009 |
# define __NTHNL(fct) fct throw ()
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __THROW
|
|
Packit |
6c4009 |
# define __THROWNL
|
|
Packit |
6c4009 |
# define __NTH(fct) fct
|
|
Packit |
6c4009 |
# define __NTHNL(fct) fct
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#else /* Not GCC. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# if (defined __cplusplus \
|
|
Packit |
6c4009 |
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
|
|
Packit |
6c4009 |
# define __inline inline
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __inline /* No inline functions. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define __THROW
|
|
Packit |
6c4009 |
# define __THROWNL
|
|
Packit |
6c4009 |
# define __NTH(fct) fct
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* GCC. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Compilers that are not clang may object to
|
|
Packit |
6c4009 |
#if defined __clang__ && __has_extension(...)
|
|
Packit |
6c4009 |
even though they do not need to evaluate the right-hand side of the &&. */
|
|
Packit |
6c4009 |
#if defined __clang__ && defined __has_extension
|
|
Packit |
6c4009 |
# define __glibc_clang_has_extension(ext) __has_extension (ext)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __glibc_clang_has_extension(ext) 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* These two macros are not used in glibc anymore. They are kept here
|
|
Packit |
6c4009 |
only because some other projects expect the macros to be defined. */
|
|
Packit |
6c4009 |
#define __P(args) args
|
|
Packit |
6c4009 |
#define __PMT(args) args
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* For these things, GCC behaves the ANSI way normally,
|
|
Packit |
6c4009 |
and the non-ANSI way under -traditional. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __CONCAT(x,y) x ## y
|
|
Packit |
6c4009 |
#define __STRING(x) #x
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* This is not a typedef so `const __ptr_t' does the right thing. */
|
|
Packit |
6c4009 |
#define __ptr_t void *
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* C++ needs to know that types and declarations are C, not C++. */
|
|
Packit |
6c4009 |
#ifdef __cplusplus
|
|
Packit |
6c4009 |
# define __BEGIN_DECLS extern "C" {
|
|
Packit |
6c4009 |
# define __END_DECLS }
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __BEGIN_DECLS
|
|
Packit |
6c4009 |
# define __END_DECLS
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Fortify support. */
|
|
Packit |
6c4009 |
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
|
|
Packit |
6c4009 |
#define __bos0(ptr) __builtin_object_size (ptr, 0)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4,3)
|
|
Packit |
6c4009 |
# define __warndecl(name, msg) \
|
|
Packit |
6c4009 |
extern void name (void) __attribute__((__warning__ (msg)))
|
|
Packit |
6c4009 |
# define __warnattr(msg) __attribute__((__warning__ (msg)))
|
|
Packit |
6c4009 |
# define __errordecl(name, msg) \
|
|
Packit |
6c4009 |
extern void name (void) __attribute__((__error__ (msg)))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __warndecl(name, msg) extern void name (void)
|
|
Packit |
6c4009 |
# define __warnattr(msg)
|
|
Packit |
6c4009 |
# define __errordecl(name, msg) extern void name (void)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Support for flexible arrays.
|
|
Packit |
6c4009 |
Headers that should use flexible arrays only if they're "real"
|
|
Packit |
6c4009 |
(e.g. only if they won't affect sizeof()) should test
|
|
Packit |
6c4009 |
#if __glibc_c99_flexarr_available. */
|
|
Packit |
6c4009 |
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
|
Packit |
6c4009 |
# define __flexarr []
|
|
Packit |
6c4009 |
# define __glibc_c99_flexarr_available 1
|
|
Packit |
6c4009 |
#elif __GNUC_PREREQ (2,97)
|
|
Packit |
6c4009 |
/* GCC 2.97 supports C99 flexible array members as an extension,
|
|
Packit |
6c4009 |
even when in C89 mode or compiling C++ (any version). */
|
|
Packit |
6c4009 |
# define __flexarr []
|
|
Packit |
6c4009 |
# define __glibc_c99_flexarr_available 1
|
|
Packit |
6c4009 |
#elif defined __GNUC__
|
|
Packit |
6c4009 |
/* Pre-2.97 GCC did not support C99 flexible arrays but did have
|
|
Packit |
6c4009 |
an equivalent extension with slightly different notation. */
|
|
Packit |
6c4009 |
# define __flexarr [0]
|
|
Packit |
6c4009 |
# define __glibc_c99_flexarr_available 1
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
/* Some other non-C99 compiler. Approximate with [1]. */
|
|
Packit |
6c4009 |
# define __flexarr [1]
|
|
Packit |
6c4009 |
# define __glibc_c99_flexarr_available 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* __asm__ ("xyz") is used throughout the headers to rename functions
|
|
Packit |
6c4009 |
at the assembly language level. This is wrapped by the __REDIRECT
|
|
Packit |
6c4009 |
macro, in order to support compilers that can do this some other
|
|
Packit |
6c4009 |
way. When compilers don't support asm-names at all, we have to do
|
|
Packit |
6c4009 |
preprocessor tricks instead (which don't have exactly the right
|
|
Packit |
6c4009 |
semantics, but it's the best we can do).
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Example:
|
|
Packit |
6c4009 |
int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined __GNUC__ && __GNUC__ >= 2
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
|
|
Packit |
6c4009 |
# ifdef __cplusplus
|
|
Packit |
6c4009 |
# define __REDIRECT_NTH(name, proto, alias) \
|
|
Packit |
6c4009 |
name proto __THROW __asm__ (__ASMNAME (#alias))
|
|
Packit |
6c4009 |
# define __REDIRECT_NTHNL(name, proto, alias) \
|
|
Packit |
6c4009 |
name proto __THROWNL __asm__ (__ASMNAME (#alias))
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __REDIRECT_NTH(name, proto, alias) \
|
|
Packit |
6c4009 |
name proto __asm__ (__ASMNAME (#alias)) __THROW
|
|
Packit |
6c4009 |
# define __REDIRECT_NTHNL(name, proto, alias) \
|
|
Packit |
6c4009 |
name proto __asm__ (__ASMNAME (#alias)) __THROWNL
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
|
|
Packit |
6c4009 |
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
#elif __SOME_OTHER_COMPILER__
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define __REDIRECT(name, proto, alias) name proto; \
|
|
Packit |
6c4009 |
_Pragma("let " #name " = " #alias)
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* GCC has various useful declarations that can be made with the
|
|
Packit |
6c4009 |
`__attribute__' syntax. All of the ways we use this do fine if
|
|
Packit |
6c4009 |
they are omitted for compilers that don't understand it. */
|
|
Packit |
6c4009 |
#if !defined __GNUC__ || __GNUC__ < 2
|
|
Packit |
6c4009 |
# define __attribute__(xyz) /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* At some point during the gcc 2.96 development the `malloc' attribute
|
|
Packit |
6c4009 |
for functions was introduced. We don't want to use it unconditionally
|
|
Packit |
6c4009 |
(although this would be possible) since it generates warnings. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (2,96)
|
|
Packit |
6c4009 |
# define __attribute_malloc__ __attribute__ ((__malloc__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_malloc__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Tell the compiler which arguments to an allocation function
|
|
Packit |
6c4009 |
indicate the size of the allocation. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4, 3)
|
|
Packit |
6c4009 |
# define __attribute_alloc_size__(params) \
|
|
Packit |
6c4009 |
__attribute__ ((__alloc_size__ params))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_alloc_size__(params) /* Ignore. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* At some point during the gcc 2.96 development the `pure' attribute
|
|
Packit |
6c4009 |
for functions was introduced. We don't want to use it unconditionally
|
|
Packit |
6c4009 |
(although this would be possible) since it generates warnings. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (2,96)
|
|
Packit |
6c4009 |
# define __attribute_pure__ __attribute__ ((__pure__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_pure__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* This declaration tells the compiler that the value is constant. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (2,5)
|
|
Packit |
6c4009 |
# define __attribute_const__ __attribute__ ((__const__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_const__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* At some point during the gcc 3.1 development the `used' attribute
|
|
Packit |
6c4009 |
for functions was introduced. We don't want to use it unconditionally
|
|
Packit |
6c4009 |
(although this would be possible) since it generates warnings. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,1)
|
|
Packit |
6c4009 |
# define __attribute_used__ __attribute__ ((__used__))
|
|
Packit |
6c4009 |
# define __attribute_noinline__ __attribute__ ((__noinline__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_used__ __attribute__ ((__unused__))
|
|
Packit |
6c4009 |
# define __attribute_noinline__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Since version 3.2, gcc allows marking deprecated functions. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,2)
|
|
Packit |
6c4009 |
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_deprecated__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Since version 4.5, gcc also allows one to specify the message printed
|
|
Packit |
6c4009 |
when a deprecated function is used. clang claims to be gcc 4.2, but
|
|
Packit |
6c4009 |
may also support this feature. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4,5) || \
|
|
Packit |
6c4009 |
__glibc_clang_has_extension (__attribute_deprecated_with_message__)
|
|
Packit |
6c4009 |
# define __attribute_deprecated_msg__(msg) \
|
|
Packit |
6c4009 |
__attribute__ ((__deprecated__ (msg)))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* At some point during the gcc 2.8 development the `format_arg' attribute
|
|
Packit |
6c4009 |
for functions was introduced. We don't want to use it unconditionally
|
|
Packit |
6c4009 |
(although this would be possible) since it generates warnings.
|
|
Packit |
6c4009 |
If several `format_arg' attributes are given for the same function, in
|
|
Packit |
6c4009 |
gcc-3.0 and older, all but the last one are ignored. In newer gccs,
|
|
Packit |
6c4009 |
all designated arguments are considered. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (2,8)
|
|
Packit |
6c4009 |
# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_format_arg__(x) /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* At some point during the gcc 2.97 development the `strfmon' format
|
|
Packit |
6c4009 |
attribute for functions was introduced. We don't want to use it
|
|
Packit |
6c4009 |
unconditionally (although this would be possible) since it
|
|
Packit |
6c4009 |
generates warnings. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (2,97)
|
|
Packit |
6c4009 |
# define __attribute_format_strfmon__(a,b) \
|
|
Packit |
6c4009 |
__attribute__ ((__format__ (__strfmon__, a, b)))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_format_strfmon__(a,b) /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The nonull function attribute allows to mark pointer parameters which
|
|
Packit |
6c4009 |
must not be NULL. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,3)
|
|
Packit |
6c4009 |
# define __nonnull(params) __attribute__ ((__nonnull__ params))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __nonnull(params)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* If fortification mode, we warn about unused results of certain
|
|
Packit |
6c4009 |
function calls which can lead to problems. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,4)
|
|
Packit |
6c4009 |
# define __attribute_warn_unused_result__ \
|
|
Packit |
6c4009 |
__attribute__ ((__warn_unused_result__))
|
|
Packit |
6c4009 |
# if __USE_FORTIFY_LEVEL > 0
|
|
Packit |
6c4009 |
# define __wur __attribute_warn_unused_result__
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_warn_unused_result__ /* empty */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifndef __wur
|
|
Packit |
6c4009 |
# define __wur /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Forces a function to be always inlined. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,2)
|
|
Packit |
6c4009 |
/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
|
|
Packit |
6c4009 |
it conflicts with this definition. Therefore undefine it first to
|
|
Packit |
6c4009 |
allow either header to be included first. */
|
|
Packit |
6c4009 |
# undef __always_inline
|
|
Packit |
6c4009 |
# define __always_inline __inline __attribute__ ((__always_inline__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# undef __always_inline
|
|
Packit |
6c4009 |
# define __always_inline __inline
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Associate error messages with the source location of the call site rather
|
|
Packit |
6c4009 |
than with the source location inside the function. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4,3)
|
|
Packit |
6c4009 |
# define __attribute_artificial__ __attribute__ ((__artificial__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_artificial__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
|
|
Packit |
6c4009 |
inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
|
|
Packit |
6c4009 |
or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
|
|
Packit |
6c4009 |
older than 4.3 may define these macros and still not guarantee GNU inlining
|
|
Packit |
6c4009 |
semantics.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
clang++ identifies itself as gcc-4.2, but has support for GNU inlining
|
|
Packit |
6c4009 |
semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
|
|
Packit |
6c4009 |
__GNUC_GNU_INLINE__ macro definitions. */
|
|
Packit |
6c4009 |
#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
|
|
Packit |
6c4009 |
|| (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
|
|
Packit |
6c4009 |
|| defined __GNUC_GNU_INLINE__)))
|
|
Packit |
6c4009 |
# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
|
|
Packit |
6c4009 |
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
|
|
Packit |
6c4009 |
# define __extern_always_inline \
|
|
Packit |
6c4009 |
extern __always_inline __attribute__ ((__gnu_inline__))
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __extern_inline extern __inline
|
|
Packit |
6c4009 |
# define __extern_always_inline extern __always_inline
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __extern_always_inline
|
|
Packit |
6c4009 |
# define __fortify_function __extern_always_inline __attribute_artificial__
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* GCC 4.3 and above allow passing all anonymous arguments of an
|
|
Packit |
6c4009 |
__extern_always_inline function to some other vararg function. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4,3)
|
|
Packit |
6c4009 |
# define __va_arg_pack() __builtin_va_arg_pack ()
|
|
Packit |
6c4009 |
# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* It is possible to compile containing GCC extensions even if GCC is
|
|
Packit |
6c4009 |
run in pedantic mode if the uses are carefully marked using the
|
|
Packit |
6c4009 |
`__extension__' keyword. But this is not generally available before
|
|
Packit |
6c4009 |
version 2.8. */
|
|
Packit |
6c4009 |
#if !__GNUC_PREREQ (2,8)
|
|
Packit |
6c4009 |
# define __extension__ /* Ignore */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* __restrict is known in EGCS 1.2 and above. */
|
|
Packit |
6c4009 |
#if !__GNUC_PREREQ (2,92)
|
|
Packit |
6c4009 |
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
|
Packit |
6c4009 |
# define __restrict restrict
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define __restrict /* Ignore */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
|
|
Packit |
6c4009 |
array_name[restrict]
|
|
Packit |
6c4009 |
GCC 3.1 supports this. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (3,1) && !defined __GNUG__
|
|
Packit |
6c4009 |
# define __restrict_arr __restrict
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# ifdef __GNUC__
|
|
Packit |
6c4009 |
# define __restrict_arr /* Not supported in old GCC. */
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
|
Packit |
6c4009 |
# define __restrict_arr restrict
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
/* Some other non-C99 compiler. */
|
|
Packit |
6c4009 |
# define __restrict_arr /* Not supported. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if __GNUC__ >= 3
|
|
Packit |
6c4009 |
# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
|
|
Packit |
6c4009 |
# define __glibc_likely(cond) __builtin_expect ((cond), 1)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __glibc_unlikely(cond) (cond)
|
|
Packit |
6c4009 |
# define __glibc_likely(cond) (cond)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __has_attribute
|
|
Packit |
6c4009 |
# define __glibc_has_attribute(attr) __has_attribute (attr)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __glibc_has_attribute(attr) 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit Service |
039d5d |
#ifdef __has_include
|
|
Packit Service |
afba0e |
/* Do not use a function-like macro, so that __has_include can inhibit
|
|
Packit Service |
afba0e |
macro expansion. */
|
|
Packit Service |
afba0e |
# define __glibc_has_include __has_include
|
|
Packit Service |
039d5d |
#else
|
|
Packit Service |
039d5d |
# define __glibc_has_include(header) 0
|
|
Packit Service |
039d5d |
#endif
|
|
Packit Service |
039d5d |
|
|
Packit |
6c4009 |
#if (!defined _Noreturn \
|
|
Packit |
6c4009 |
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
|
|
Packit |
6c4009 |
&& !__GNUC_PREREQ (4,7))
|
|
Packit |
6c4009 |
# if __GNUC_PREREQ (2,8)
|
|
Packit |
6c4009 |
# define _Noreturn __attribute__ ((__noreturn__))
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define _Noreturn
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (8, 0)
|
|
Packit |
6c4009 |
/* Describes a char array whose address can safely be passed as the first
|
|
Packit |
6c4009 |
argument to strncpy and strncat, as the char array is not necessarily
|
|
Packit |
6c4009 |
a NUL-terminated string. */
|
|
Packit |
6c4009 |
# define __attribute_nonstring__ __attribute__ ((__nonstring__))
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __attribute_nonstring__
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if (!defined _Static_assert && !defined __cplusplus \
|
|
Packit |
6c4009 |
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
|
|
Packit |
6c4009 |
&& (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
|
|
Packit |
6c4009 |
# define _Static_assert(expr, diagnostic) \
|
|
Packit |
6c4009 |
extern int (*__Static_assert_function (void)) \
|
|
Packit |
6c4009 |
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <bits/wordsize.h>
|
|
Packit |
6c4009 |
#include <bits/long-double.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
|
|
Packit |
6c4009 |
# define __LDBL_COMPAT 1
|
|
Packit |
6c4009 |
# ifdef __REDIRECT
|
|
Packit |
6c4009 |
# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
|
|
Packit |
6c4009 |
# define __LDBL_REDIR(name, proto) \
|
|
Packit |
6c4009 |
__LDBL_REDIR1 (name, proto, __nldbl_##name)
|
|
Packit |
6c4009 |
# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
|
|
Packit |
6c4009 |
# define __LDBL_REDIR_NTH(name, proto) \
|
|
Packit |
6c4009 |
__LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
|
|
Packit |
6c4009 |
# define __LDBL_REDIR1_DECL(name, alias) \
|
|
Packit |
6c4009 |
extern __typeof (name) name __asm (__ASMNAME (#alias));
|
|
Packit |
6c4009 |
# define __LDBL_REDIR_DECL(name) \
|
|
Packit |
6c4009 |
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
|
|
Packit |
6c4009 |
# define __REDIRECT_LDBL(name, proto, alias) \
|
|
Packit |
6c4009 |
__LDBL_REDIR1 (name, proto, __nldbl_##alias)
|
|
Packit |
6c4009 |
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
|
|
Packit |
6c4009 |
__LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#if !defined __LDBL_COMPAT || !defined __REDIRECT
|
|
Packit |
6c4009 |
# define __LDBL_REDIR1(name, proto, alias) name proto
|
|
Packit |
6c4009 |
# define __LDBL_REDIR(name, proto) name proto
|
|
Packit |
6c4009 |
# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
|
|
Packit |
6c4009 |
# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
|
|
Packit |
6c4009 |
# define __LDBL_REDIR_DECL(name)
|
|
Packit |
6c4009 |
# ifdef __REDIRECT
|
|
Packit |
6c4009 |
# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
|
|
Packit |
6c4009 |
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
|
|
Packit |
6c4009 |
__REDIRECT_NTH (name, proto, alias)
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
|
|
Packit |
6c4009 |
intended for use in preprocessor macros.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Note: MESSAGE must be a _single_ string; concatenation of string
|
|
Packit |
6c4009 |
literals is not supported. */
|
|
Packit |
6c4009 |
#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
|
|
Packit |
6c4009 |
# define __glibc_macro_warning1(message) _Pragma (#message)
|
|
Packit |
6c4009 |
# define __glibc_macro_warning(message) \
|
|
Packit |
6c4009 |
__glibc_macro_warning1 (GCC warning message)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __glibc_macro_warning(msg)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Generic selection (ISO C11) is a C-only feature, available in GCC
|
|
Packit |
6c4009 |
since version 4.9. Previous versions do not provide generic
|
|
Packit |
6c4009 |
selection, even though they might set __STDC_VERSION__ to 201112L,
|
|
Packit |
6c4009 |
when in -std=c11 mode. Thus, we must check for !defined __GNUC__
|
|
Packit |
6c4009 |
when testing __STDC_VERSION__ for generic selection support.
|
|
Packit |
6c4009 |
On the other hand, Clang also defines __GNUC__, so a clang-specific
|
|
Packit |
6c4009 |
check is required to enable the use of generic selection. */
|
|
Packit |
6c4009 |
#if !defined __cplusplus \
|
|
Packit |
6c4009 |
&& (__GNUC_PREREQ (4, 9) \
|
|
Packit |
6c4009 |
|| __glibc_clang_has_extension (c_generic_selections) \
|
|
Packit |
6c4009 |
|| (!defined __GNUC__ && defined __STDC_VERSION__ \
|
|
Packit |
6c4009 |
&& __STDC_VERSION__ >= 201112L))
|
|
Packit |
6c4009 |
# define __HAVE_GENERIC_SELECTION 1
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define __HAVE_GENERIC_SELECTION 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* sys/cdefs.h */
|