1 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
3 Copyright (C) 2009-2015 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 /* Written by Eric Blake. */
21 * POSIX 2008 <stddef.h> for platforms that have issues.
22 * <http://www.opengroup.org/susv3xbd/stddef.h.html>
26 @PRAGMA_SYSTEM_HEADER@
30 #if defined __need_wchar_t || defined __need_size_t \
31 || defined __need_ptrdiff_t || defined __need_NULL \
32 || defined __need_wint_t
33 /* Special invocation convention inside gcc header files. In
34 particular, gcc provides a version of <stddef.h> that blindly
35 redefines NULL even when __need_wint_t was defined, even though
36 wint_t is not normally provided by <stddef.h>. Hence, we must
37 remember if special invocation has ever been used to obtain wint_t,
38 in which case we need to clean up NULL yet again. */
40 # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
42 # define _GL_STDDEF_WINT_T
44 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
48 /* Normal invocation convention. */
50 # ifndef _@GUARD_PREFIX@_STDDEF_H
52 /* The include_next requires a split double-inclusion guard. */
54 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
56 /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
57 # if (@REPLACE_NULL@ \
58 && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
61 /* ISO C++ says that the macro NULL must expand to an integer constant
62 expression, hence '((void *) 0)' is not allowed in C++. */
64 /* GNU C++ has a __null macro that behaves like an integer ('int' or
65 'long') but has the same size as a pointer. Use that, to avoid
72 # define NULL ((void *) 0)
76 # ifndef _@GUARD_PREFIX@_STDDEF_H
77 # define _@GUARD_PREFIX@_STDDEF_H
79 /* Some platforms lack wchar_t. */
84 /* Some platforms lack max_align_t. */
85 #if !@HAVE_MAX_ALIGN_T@
95 # endif /* _@GUARD_PREFIX@_STDDEF_H */
96 # endif /* _@GUARD_PREFIX@_STDDEF_H */
97 #endif /* __need_XXX */