2N/A/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
2N/A
2N/A Copyright (C) 2009, 2010 Free Software Foundation, Inc.
2N/A
2N/A This program is free software; you can redistribute it and/or modify
2N/A it under the terms of the GNU General Public License as published by
2N/A the Free Software Foundation; either version 3, or (at your option)
2N/A any later version.
2N/A
2N/A This program is distributed in the hope that it will be useful,
2N/A but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A GNU General Public License for more details.
2N/A
2N/A You should have received a copy of the GNU General Public License
2N/A along with this program; if not, write to the Free Software Foundation,
2N/A Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
2N/A
2N/A/* Written by Eric Blake. */
2N/A
2N/A/*
2N/A * POSIX 2008 <stddef.h> for platforms that have issues.
2N/A * <http://www.opengroup.org/susv3xbd/stddef.h.html>
2N/A */
2N/A
2N/A#if __GNUC__ >= 3
2N/A@PRAGMA_SYSTEM_HEADER@
2N/A#endif
2N/A
2N/A#if defined __need_wchar_t || defined __need_size_t \
2N/A || defined __need_ptrdiff_t || defined __need_NULL \
2N/A || defined __need_wint_t
2N/A/* Special invocation convention inside gcc header files. In
2N/A particular, gcc provides a version of <stddef.h> that blindly
2N/A redefines NULL even when __need_wint_t was defined, even though
2N/A wint_t is not normally provided by <stddef.h>. Hence, we must
2N/A remember if special invocation has ever been used to obtain wint_t,
2N/A in which case we need to clean up NULL yet again. */
2N/A
2N/A# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
2N/A# ifdef __need_wint_t
2N/A# undef _GL_STDDEF_H
2N/A# define _GL_STDDEF_WINT_T
2N/A# endif
2N/A# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
2N/A# endif
2N/A
2N/A#else
2N/A/* Normal invocation convention. */
2N/A
2N/A# ifndef _GL_STDDEF_H
2N/A
2N/A/* The include_next requires a split double-inclusion guard. */
2N/A
2N/A# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
2N/A
2N/A# ifndef _GL_STDDEF_H
2N/A# define _GL_STDDEF_H
2N/A
2N/A/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
2N/A#if @REPLACE_NULL@
2N/A# undef NULL
2N/A# ifdef __cplusplus
2N/A /* ISO C++ says that the macro NULL must expand to an integer constant
2N/A expression, hence '((void *) 0)' is not allowed in C++. */
2N/A# if __GNUG__ >= 3
2N/A /* GNU C++ has a __null macro that behaves like an integer ('int' or
2N/A 'long') but has the same size as a pointer. Use that, to avoid
2N/A warnings. */
2N/A# define NULL __null
2N/A# else
2N/A# define NULL 0L
2N/A# endif
2N/A# else
2N/A# define NULL ((void *) 0)
2N/A# endif
2N/A#endif
2N/A
2N/A/* Some platforms lack wchar_t. */
2N/A#if !@HAVE_WCHAR_T@
2N/A# define wchar_t int
2N/A#endif
2N/A
2N/A# endif /* _GL_STDDEF_H */
2N/A# endif /* _GL_STDDEF_H */
2N/A#endif /* __need_XXX */