112308
|
1 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
|
|
2
|
|
3 Copyright (C) 2009-2011 Free Software Foundation, Inc.
|
|
4
|
|
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)
|
|
8 any later version.
|
|
9
|
|
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.
|
|
14
|
|
15 You should have received a copy of the GNU General Public License
|
|
16 along with this program; if not, write to the Free Software Foundation,
|
|
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
18
|
|
19 /* Written by Eric Blake. */
|
|
20
|
|
21 /*
|
|
22 * POSIX 2008 <stddef.h> for platforms that have issues.
|
|
23 * <http://www.opengroup.org/susv3xbd/stddef.h.html>
|
|
24 */
|
|
25
|
|
26 #if __GNUC__ >= 3
|
|
27 @PRAGMA_SYSTEM_HEADER@
|
|
28 #endif
|
|
29 @PRAGMA_COLUMNS@
|
|
30
|
|
31 #if defined __need_wchar_t || defined __need_size_t \
|
|
32 || defined __need_ptrdiff_t || defined __need_NULL \
|
|
33 || defined __need_wint_t
|
|
34 /* Special invocation convention inside gcc header files. In
|
|
35 particular, gcc provides a version of <stddef.h> that blindly
|
|
36 redefines NULL even when __need_wint_t was defined, even though
|
|
37 wint_t is not normally provided by <stddef.h>. Hence, we must
|
|
38 remember if special invocation has ever been used to obtain wint_t,
|
|
39 in which case we need to clean up NULL yet again. */
|
|
40
|
|
41 # if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
|
|
42 # ifdef __need_wint_t
|
|
43 # undef _GL_STDDEF_H
|
|
44 # define _GL_STDDEF_WINT_T
|
|
45 # endif
|
|
46 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
|
47 # endif
|
|
48
|
|
49 #else
|
|
50 /* Normal invocation convention. */
|
|
51
|
|
52 # ifndef _GL_STDDEF_H
|
|
53
|
|
54 /* The include_next requires a split double-inclusion guard. */
|
|
55
|
|
56 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
|
57
|
|
58 # ifndef _GL_STDDEF_H
|
|
59 # define _GL_STDDEF_H
|
|
60
|
|
61 /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
|
|
62 #if @REPLACE_NULL@
|
|
63 # undef NULL
|
|
64 # ifdef __cplusplus
|
|
65 /* ISO C++ says that the macro NULL must expand to an integer constant
|
|
66 expression, hence '((void *) 0)' is not allowed in C++. */
|
|
67 # if __GNUG__ >= 3
|
|
68 /* GNU C++ has a __null macro that behaves like an integer ('int' or
|
|
69 'long') but has the same size as a pointer. Use that, to avoid
|
|
70 warnings. */
|
|
71 # define NULL __null
|
|
72 # else
|
|
73 # define NULL 0L
|
|
74 # endif
|
|
75 # else
|
|
76 # define NULL ((void *) 0)
|
|
77 # endif
|
|
78 #endif
|
|
79
|
|
80 /* Some platforms lack wchar_t. */
|
|
81 #if !@HAVE_WCHAR_T@
|
|
82 # define wchar_t int
|
|
83 #endif
|
|
84
|
|
85 # endif /* _GL_STDDEF_H */
|
|
86 # endif /* _GL_STDDEF_H */
|
|
87 #endif /* __need_XXX */
|