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