OSDN Git Service

[__sequent__]: #undef _PTRDIFF_T_ at beginning, if defined.
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / stddef.h
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 _PTRDIFF_T_
39 #ifndef __need_ptrdiff_t
40 #undef _SIZE_T_
41 #undef _WCHAR_T_
42 #endif
43 #endif /* _ANSI_H_ */
44
45 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
46    Just ignore it.  */
47 #if defined (__sequent__) && defined (_PTRDIFF_T_)
48 #undef _PTRDIFF_T_
49 #endif
50
51 /* In case nobody has defined these types, but we aren't running under
52    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
53    __WCHAR_TYPE__ have reasonable values.  This can happen if the
54    parts of GCC is compiled by an older compiler, that actually
55    include gstddef.h, such as collect2.  */
56
57 /* Signed type of difference of two pointers.  */
58
59 /* Define this type if we are doing the whole job,
60    or if we want this type in particular.  */
61 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
62 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
63 #ifndef _T_PTRDIFF_
64 #ifndef _T_PTRDIFF
65 #ifndef __PTRDIFF_T
66 #ifndef _PTRDIFF_T_
67 #ifndef ___int_ptrdiff_t_h
68 #ifndef _GCC_PTRDIFF_T
69 #define _PTRDIFF_T
70 #define _T_PTRDIFF_
71 #define _T_PTRDIFF
72 #define __PTRDIFF_T
73 #define _PTRDIFF_T_
74 #define ___int_ptrdiff_t_h
75 #define _GCC_PTRDIFF_T
76 #ifndef __PTRDIFF_TYPE__
77 #define __PTRDIFF_TYPE__ long int
78 #endif
79 typedef __PTRDIFF_TYPE__ ptrdiff_t;
80 #endif /* _GCC_PTRDIFF_T */
81 #endif /* ___int_ptrdiff_t_h */
82 #endif /* _PTRDIFF_T_ */
83 #endif /* __PTRDIFF_T */
84 #endif /* _T_PTRDIFF */
85 #endif /* _T_PTRDIFF_ */
86 #endif /* _PTRDIFF_T */
87
88 /* If this symbol has done its job, get rid of it.  */
89 #undef  __need_ptrdiff_t
90
91 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
92
93 /* Unsigned type of `sizeof' something.  */
94
95 /* Define this type if we are doing the whole job,
96    or if we want this type in particular.  */
97 #if defined (_STDDEF_H) || defined (__need_size_t)
98 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
99 #ifndef _T_SIZE_
100 #ifndef _T_SIZE
101 #ifndef __SIZE_T
102 #ifndef _SIZE_T_
103 #ifndef ___int_size_t_h
104 #ifndef _GCC_SIZE_T
105 #ifndef _SIZET_
106 #define _SIZE_T
107 #define _T_SIZE_
108 #define _T_SIZE
109 #define __SIZE_T
110 #define _SIZE_T_
111 #define ___int_size_t_h
112 #define _GCC_SIZE_T
113 #define _SIZET_
114 #ifndef __SIZE_TYPE__
115 #define __SIZE_TYPE__ long unsigned int
116 #endif
117 typedef __SIZE_TYPE__ size_t;
118 #endif /* _SIZET_ */
119 #endif /* _GCC_SIZE_T */
120 #endif /* ___int_size_t_h */
121 #endif /* _SIZE_T_ */
122 #endif /* __SIZE_T */
123 #endif /* _T_SIZE */
124 #endif /* _T_SIZE_ */
125 #endif /* _SIZE_T */
126 #undef  __need_size_t
127 #endif /* _STDDEF_H or __need_size_t.  */
128
129
130 /* Wide character type.
131    Locale-writers should change this as necessary to
132    be big enough to hold unique values not between 0 and 127,
133    and not (wchar_t) -1, for each defined multibyte character.  */
134
135 /* Define this type if we are doing the whole job,
136    or if we want this type in particular.  */
137 #if defined (_STDDEF_H) || defined (__need_wchar_t)
138 #ifndef _WCHAR_T
139 #ifndef _T_WCHAR_
140 #ifndef _T_WCHAR
141 #ifndef __WCHAR_T
142 #ifndef _WCHAR_T_
143 #ifndef ___int_wchar_t_h
144 #ifndef _GCC_WCHAR_T
145 #define _WCHAR_T
146 #define _T_WCHAR_
147 #define _T_WCHAR
148 #define __WCHAR_T
149 #define _WCHAR_T_
150 #define ___int_wchar_t_h
151 #define _GCC_WCHAR_T
152 #ifndef __WCHAR_TYPE__
153 #define __WCHAR_TYPE__ int
154 #endif
155 #ifdef __GNUG__
156 /* In C++, wchar_t is a distinct basic type,
157    and we can expect __wchar_t to be defined by cc1plus.  */
158 typedef __wchar_t wchar_t;
159 #else
160 /* In C, cpp tells us which type to make an alias for.  */
161 typedef __WCHAR_TYPE__ wchar_t;
162 #endif
163 #endif
164 #endif
165 #endif
166 #endif
167 #endif
168 #endif
169 #endif
170 #undef  __need_wchar_t
171 #endif /* _STDDEF_H or __need_wchar_t.  */
172
173 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
174     are already defined.  We need not worry about the case of wanting just
175     one of these types, not on 4.3bsd-net2, because only the GNU libc
176     header files do that.  */
177 #ifdef _ANSI_H_
178 #undef _PTRDIFF_T_
179 #ifdef _STDDEF_H /* This is a kludge.
180                     _STDDEF_H is defined when we are using the whole file,
181                     undefined when obstack.h wants just ptrdiff_t.  */
182 #undef _SIZE_T_
183 #undef _WCHAR_T_
184 #endif
185 #endif
186
187 #endif /* __sys_stdtypes_h */
188
189 /* A null pointer constant.  */
190
191 #if defined (_STDDEF_H) || defined (__need_NULL)
192 #undef NULL             /* in case <stdio.h> has defined it. */
193 #define NULL ((void *)0)
194 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
195 #undef  __need_NULL
196
197 #ifdef _STDDEF_H
198
199 /* Offset of member MEMBER in a struct of type TYPE.  */
200
201 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
202
203 #endif /* _STDDEF_H was defined this time */
204
205 #endif /* _ANSI_STDDEF_H was not defined before */
206 #endif /* _STDDEF_H_ was not defined before */
207 #endif /* _STDDEF_H was not defined before */