Blame gl/stddef.in.h

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