Blame lib/stddef.in.h

Packit Service fdd496
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
Packit Service fdd496
Packit Service fdd496
   Copyright (C) 2009-2017 Free Software Foundation, Inc.
Packit Service fdd496
Packit Service fdd496
   This program is free software; you can redistribute it and/or modify
Packit Service fdd496
   it under the terms of the GNU General Public License as published by
Packit Service fdd496
   the Free Software Foundation; either version 3, or (at your option)
Packit Service fdd496
   any later version.
Packit Service fdd496
Packit Service fdd496
   This program is distributed in the hope that it will be useful,
Packit Service fdd496
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fdd496
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service fdd496
   GNU General Public License for more details.
Packit Service fdd496
Packit Service fdd496
   You should have received a copy of the GNU General Public License
Packit Service fdd496
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit Service fdd496
Packit Service fdd496
/* Written by Eric Blake.  */
Packit Service fdd496
Packit Service fdd496
/*
Packit Service fdd496
 * POSIX 2008 <stddef.h> for platforms that have issues.
Packit Service fdd496
 * <http://www.opengroup.org/susv3xbd/stddef.h.html>
Packit Service fdd496
 */
Packit Service fdd496
Packit Service fdd496
#if __GNUC__ >= 3
Packit Service fdd496
@PRAGMA_SYSTEM_HEADER@
Packit Service fdd496
#endif
Packit Service fdd496
@PRAGMA_COLUMNS@
Packit Service fdd496
Packit Service fdd496
#if defined __need_wchar_t || defined __need_size_t  \
Packit Service fdd496
  || defined __need_ptrdiff_t || defined __need_NULL \
Packit Service fdd496
  || defined __need_wint_t
Packit Service fdd496
/* Special invocation convention inside gcc header files.  In
Packit Service fdd496
   particular, gcc provides a version of <stddef.h> that blindly
Packit Service fdd496
   redefines NULL even when __need_wint_t was defined, even though
Packit Service fdd496
   wint_t is not normally provided by <stddef.h>.  Hence, we must
Packit Service fdd496
   remember if special invocation has ever been used to obtain wint_t,
Packit Service fdd496
   in which case we need to clean up NULL yet again.  */
Packit Service fdd496
Packit Service fdd496
# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
Packit Service fdd496
#  ifdef __need_wint_t
Packit Service fdd496
#   define _GL_STDDEF_WINT_T
Packit Service fdd496
#  endif
Packit Service fdd496
#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
Packit Service fdd496
# endif
Packit Service fdd496
Packit Service fdd496
#else
Packit Service fdd496
/* Normal invocation convention.  */
Packit Service fdd496
Packit Service fdd496
# ifndef _@GUARD_PREFIX@_STDDEF_H
Packit Service fdd496
Packit Service fdd496
/* The include_next requires a split double-inclusion guard.  */
Packit Service fdd496
Packit Service fdd496
#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
Packit Service fdd496
Packit Service fdd496
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
Packit Service fdd496
#  if (@REPLACE_NULL@ \
Packit Service fdd496
       && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
Packit Service fdd496
#   undef NULL
Packit Service fdd496
#   ifdef __cplusplus
Packit Service fdd496
   /* ISO C++ says that the macro NULL must expand to an integer constant
Packit Service fdd496
      expression, hence '((void *) 0)' is not allowed in C++.  */
Packit Service fdd496
#    if __GNUG__ >= 3
Packit Service fdd496
    /* GNU C++ has a __null macro that behaves like an integer ('int' or
Packit Service fdd496
       'long') but has the same size as a pointer.  Use that, to avoid
Packit Service fdd496
       warnings.  */
Packit Service fdd496
#     define NULL __null
Packit Service fdd496
#    else
Packit Service fdd496
#     define NULL 0L
Packit Service fdd496
#    endif
Packit Service fdd496
#   else
Packit Service fdd496
#    define NULL ((void *) 0)
Packit Service fdd496
#   endif
Packit Service fdd496
#  endif
Packit Service fdd496
Packit Service fdd496
#  ifndef _@GUARD_PREFIX@_STDDEF_H
Packit Service fdd496
#   define _@GUARD_PREFIX@_STDDEF_H
Packit Service fdd496
Packit Service fdd496
/* Some platforms lack wchar_t.  */
Packit Service fdd496
#if !@HAVE_WCHAR_T@
Packit Service fdd496
# define wchar_t int
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
/* Some platforms lack max_align_t.  The check for _GCC_MAX_ALIGN_T is
Packit Service fdd496
   a hack in case the configure-time test was done with g++ even though
Packit Service fdd496
   we are currently compiling with gcc.  */
Packit Service fdd496
#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T)
Packit Service fdd496
/* On the x86, the maximum storage alignment of double, long, etc. is 4,
Packit Service fdd496
   but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
Packit Service fdd496
   and the C11 standard allows this.  Work around this problem by
Packit Service fdd496
   using __alignof__ (which returns 8 for double) rather than _Alignof
Packit Service fdd496
   (which returns 4), and align each union member accordingly.  */
Packit Service fdd496
# ifdef __GNUC__
Packit Service fdd496
#  define _GL_STDDEF_ALIGNAS(type) \
Packit Service fdd496
     __attribute__ ((__aligned__ (__alignof__ (type))))
Packit Service fdd496
# else
Packit Service fdd496
#  define _GL_STDDEF_ALIGNAS(type) /* */
Packit Service fdd496
# endif
Packit Service fdd496
typedef union
Packit Service fdd496
{
Packit Service fdd496
  char *__p _GL_STDDEF_ALIGNAS (char *);
Packit Service fdd496
  double __d _GL_STDDEF_ALIGNAS (double);
Packit Service fdd496
  long double __ld _GL_STDDEF_ALIGNAS (long double);
Packit Service fdd496
  long int __i _GL_STDDEF_ALIGNAS (long int);
Packit Service fdd496
} max_align_t;
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
#  endif /* _@GUARD_PREFIX@_STDDEF_H */
Packit Service fdd496
# endif /* _@GUARD_PREFIX@_STDDEF_H */
Packit Service fdd496
#endif /* __need_XXX */