Commit | Line | Data |
---|---|---|
9bf86ebb PR |
1 | #ifndef _STDDEF_H |
2 | #ifndef _STDDEF_H_ | |
3 | #ifndef _ANSI_STDDEF_H | |
4 | ||
5 | /* Any one of these symbols __need_* means that GNU libc | |
6 | wants us just to define one data type. So don't define | |
7 | the symbols that indicate this file's entire job has been done. */ | |
8 | #if (!defined(__need_wchar_t) && !defined(__need_size_t) \ | |
9 | && !defined(__need_ptrdiff_t) && !defined(__need_NULL)) | |
10 | #define _STDDEF_H | |
11 | #define _STDDEF_H_ | |
12 | /* snaroff@next.com says the NeXT needs this. */ | |
13 | #define _ANSI_STDDEF_H | |
14 | #endif | |
15 | ||
16 | #ifndef __sys_stdtypes_h | |
17 | /* This avoids lossage on SunOS but only if stdtypes.h comes first. | |
18 | There's no way to win with the other order! Sun lossage. */ | |
19 | ||
20 | /* On 4.3bsd-net2, make sure ansi.h is included, so we have | |
21 | one less case to deal with in the following. */ | |
22 | #if defined (__BSD_NET2__) || defined (____386BSD____) | |
23 | #include <machine/ansi.h> | |
24 | #endif | |
25 | ||
26 | /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are | |
27 | defined if the corresponding type is *not* defined. */ | |
28 | #ifdef _ANSI_H_ | |
29 | #ifndef _SIZE_T_ | |
30 | #define _SIZE_T | |
31 | #endif | |
32 | #ifndef _PTRDIFF_T_ | |
33 | #define _PTRDIFF_T | |
34 | #endif | |
35 | #ifndef _WCHAR_T_ | |
36 | #define _WCHAR_T | |
37 | #endif | |
38 | /* Undef _FOO_T_ if we are supposed to define foo_t. */ | |
39 | #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) | |
40 | #undef _PTRDIFF_T_ | |
41 | #endif | |
42 | #if defined (__need_size_t) || defined (_STDDEF_H_) | |
43 | #undef _SIZE_T_ | |
44 | #endif | |
45 | #if defined (__need_wchar_t) || defined (_STDDEF_H_) | |
46 | #undef _WCHAR_T_ | |
47 | #endif | |
48 | #endif /* _ANSI_H_ */ | |
49 | ||
50 | /* Sequent's header files use _PTRDIFF_T_ in some conflicting way. | |
51 | Just ignore it. */ | |
52 | #if defined (__sequent__) && defined (_PTRDIFF_T_) | |
53 | #undef _PTRDIFF_T_ | |
54 | #endif | |
55 | ||
56 | /* In case nobody has defined these types, but we aren't running under | |
57 | GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and | |
58 | __WCHAR_TYPE__ have reasonable values. This can happen if the | |
59 | parts of GCC is compiled by an older compiler, that actually | |
60 | include gstddef.h, such as collect2. */ | |
61 | ||
62 | /* Signed type of difference of two pointers. */ | |
63 | ||
64 | /* Define this type if we are doing the whole job, | |
65 | or if we want this type in particular. */ | |
66 | #if defined (_STDDEF_H) || defined (__need_ptrdiff_t) | |
67 | #ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */ | |
68 | #ifndef _T_PTRDIFF_ | |
69 | #ifndef _T_PTRDIFF | |
70 | #ifndef __PTRDIFF_T | |
71 | #ifndef _PTRDIFF_T_ | |
72 | #ifndef ___int_ptrdiff_t_h | |
73 | #ifndef _GCC_PTRDIFF_T | |
74 | #define _PTRDIFF_T | |
75 | #define _T_PTRDIFF_ | |
76 | #define _T_PTRDIFF | |
77 | #define __PTRDIFF_T | |
78 | #define _PTRDIFF_T_ | |
79 | #define ___int_ptrdiff_t_h | |
80 | #define _GCC_PTRDIFF_T | |
81 | #ifndef __PTRDIFF_TYPE__ | |
82 | #define __PTRDIFF_TYPE__ long int | |
83 | #endif | |
84 | typedef __PTRDIFF_TYPE__ ptrdiff_t; | |
85 | #endif /* _GCC_PTRDIFF_T */ | |
86 | #endif /* ___int_ptrdiff_t_h */ | |
87 | #endif /* _PTRDIFF_T_ */ | |
88 | #endif /* __PTRDIFF_T */ | |
89 | #endif /* _T_PTRDIFF */ | |
90 | #endif /* _T_PTRDIFF_ */ | |
91 | #endif /* _PTRDIFF_T */ | |
92 | ||
93 | /* If this symbol has done its job, get rid of it. */ | |
94 | #undef __need_ptrdiff_t | |
95 | ||
96 | #endif /* _STDDEF_H or __need_ptrdiff_t. */ | |
97 | ||
98 | /* Unsigned type of `sizeof' something. */ | |
99 | ||
100 | /* Define this type if we are doing the whole job, | |
101 | or if we want this type in particular. */ | |
102 | #if defined (_STDDEF_H) || defined (__need_size_t) | |
103 | #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */ | |
104 | #ifndef _SYS_SIZE_T_H | |
105 | #ifndef _T_SIZE_ | |
106 | #ifndef _T_SIZE | |
107 | #ifndef __SIZE_T | |
108 | #ifndef _SIZE_T_ | |
109 | #ifndef ___int_size_t_h | |
110 | #ifndef _GCC_SIZE_T | |
111 | #ifndef _SIZET_ | |
112 | #define _SIZE_T | |
113 | #define _SYS_SIZE_T_H | |
114 | #define _T_SIZE_ | |
115 | #define _T_SIZE | |
116 | #define __SIZE_T | |
117 | #define _SIZE_T_ | |
118 | #define ___int_size_t_h | |
119 | #define _GCC_SIZE_T | |
120 | #define _SIZET_ | |
121 | #ifndef __SIZE_TYPE__ | |
122 | #define __SIZE_TYPE__ long unsigned int | |
123 | #endif | |
124 | #if !(defined (__GNUG__) && defined (size_t)) | |
125 | typedef __SIZE_TYPE__ size_t; | |
126 | #endif /* !(defined (__GNUG__) && defined (size_t)) */ | |
127 | #endif /* _SIZET_ */ | |
128 | #endif /* _GCC_SIZE_T */ | |
129 | #endif /* ___int_size_t_h */ | |
130 | #endif /* _SIZE_T_ */ | |
131 | #endif /* __SIZE_T */ | |
132 | #endif /* _T_SIZE */ | |
133 | #endif /* _T_SIZE_ */ | |
134 | #endif /* _SYS_SIZE_T_H */ | |
135 | #endif /* _SIZE_T */ | |
136 | #undef __need_size_t | |
137 | #endif /* _STDDEF_H or __need_size_t. */ | |
138 | ||
139 | ||
140 | /* Wide character type. | |
141 | Locale-writers should change this as necessary to | |
142 | be big enough to hold unique values not between 0 and 127, | |
143 | and not (wchar_t) -1, for each defined multibyte character. */ | |
144 | ||
145 | /* Define this type if we are doing the whole job, | |
146 | or if we want this type in particular. */ | |
147 | #if defined (_STDDEF_H) || defined (__need_wchar_t) | |
148 | #ifndef _WCHAR_T | |
149 | #ifndef _T_WCHAR_ | |
150 | #ifndef _T_WCHAR | |
151 | #ifndef __WCHAR_T | |
152 | #ifndef _WCHAR_T_ | |
153 | #ifndef ___int_wchar_t_h | |
154 | #ifndef _GCC_WCHAR_T | |
155 | #define _WCHAR_T | |
156 | #define _T_WCHAR_ | |
157 | #define _T_WCHAR | |
158 | #define __WCHAR_T | |
159 | #define _WCHAR_T_ | |
160 | #define ___int_wchar_t_h | |
161 | #define _GCC_WCHAR_T | |
162 | #ifndef __WCHAR_TYPE__ | |
163 | #define __WCHAR_TYPE__ int | |
164 | #endif | |
165 | #ifdef __GNUG__ | |
166 | /* In C++, wchar_t is a distinct basic type, | |
167 | and we can expect __wchar_t to be defined by cc1plus. */ | |
168 | typedef __wchar_t wchar_t; | |
169 | #else | |
170 | /* In C, cpp tells us which type to make an alias for. */ | |
171 | typedef __WCHAR_TYPE__ wchar_t; | |
172 | #endif | |
173 | #endif | |
174 | #endif | |
175 | #endif | |
176 | #endif | |
177 | #endif | |
178 | #endif | |
179 | #endif | |
180 | #undef __need_wchar_t | |
181 | #endif /* _STDDEF_H or __need_wchar_t. */ | |
182 | ||
183 | /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. | |
184 | are already defined. */ | |
185 | #ifdef _ANSI_H_ | |
186 | #ifdef _GCC_PTRDIFF_T_ | |
187 | #undef _PTRDIFF_T_ | |
188 | #endif | |
189 | #ifdef _GCC_SIZE_T_ | |
190 | #undef _SIZE_T_ | |
191 | #endif | |
192 | #ifdef _GCC_WCHAR_T_ | |
193 | #undef _WCHAR_T_ | |
194 | #endif | |
195 | #endif /* _ANSI_H_ */ | |
196 | ||
197 | #endif /* __sys_stdtypes_h */ | |
198 | ||
199 | /* A null pointer constant. */ | |
200 | ||
201 | #if defined (_STDDEF_H) || defined (__need_NULL) | |
202 | #undef NULL /* in case <stdio.h> has defined it. */ | |
203 | #define NULL ((void *)0) | |
204 | #endif /* NULL not defined and <stddef.h> or need NULL. */ | |
205 | #undef __need_NULL | |
206 | ||
207 | #ifdef _STDDEF_H | |
208 | ||
209 | /* Offset of member MEMBER in a struct of type TYPE. */ | |
210 | ||
211 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |
212 | ||
213 | #endif /* _STDDEF_H was defined this time */ | |
214 | ||
215 | #endif /* _ANSI_STDDEF_H was not defined before */ | |
216 | #endif /* _STDDEF_H_ was not defined before */ | |
217 | #endif /* _STDDEF_H was not defined before */ |