~steve-sk2/mingw-w64/oneiric

« back to all changes in this revision

Viewing changes to mingw-w64-headers/include/stddef.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-11-18 00:04:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101118000446-xe24b423su55onyl
Tags: 1.0+20101003-1
* New maintainer. (Closes: #594371.)
* New upstream snapshot:
  - Includes getopt.h. (Closes: #569914.)
* Build g++ for Win64. (Closes: #600451.)
* Standards-Version 3.9.1 (new packaging).
* Include patch from
  http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64?view=revision&revision=3715
  as suggested by Rafaël Carré.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * This file has no copyright assigned and is placed in the Public Domain.
 
3
 * This file is part of the w64 mingw-runtime package.
 
4
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 
5
 */
 
6
 
 
7
#include <_mingw.h>
 
8
 
 
9
#ifndef _INC_STDDEF
 
10
#define _INC_STDDEF
 
11
 
 
12
#ifdef __cplusplus
 
13
extern "C" {
 
14
#endif
 
15
 
 
16
#ifndef _CRT_ERRNO_DEFINED
 
17
#define _CRT_ERRNO_DEFINED
 
18
  _CRTIMP extern int *__cdecl _errno(void);
 
19
#define errno (*_errno())
 
20
  errno_t __cdecl _set_errno(int _Value);
 
21
  errno_t __cdecl _get_errno(int *_Value);
 
22
#endif /* _CRT_ERRNO_DEFINED */
 
23
 
 
24
  _CRTIMP extern unsigned long __cdecl __threadid(void);
 
25
#define _threadid (__threadid())
 
26
  _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
 
27
 
 
28
#ifdef __cplusplus
 
29
}
 
30
#endif
 
31
 
 
32
#endif /* _INC_STDDEF */
 
33
 
 
34
/*
 
35
 * ISO C Standard:  7.17  Common definitions  <stddef.h>
 
36
 */
 
37
#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
 
38
     && !defined(__STDDEF_H__)) \
 
39
    || defined(__need_wchar_t) || defined(__need_size_t) \
 
40
    || defined(__need_ptrdiff_t) || defined(__need_NULL) \
 
41
    || defined(__need_wint_t)
 
42
 
 
43
/* Any one of these symbols __need_* means that GNU libc
 
44
   wants us just to define one data type.  So don't define
 
45
   the symbols that indicate this file's entire job has been done.  */
 
46
#if (!defined(__need_wchar_t) && !defined(__need_size_t)        \
 
47
     && !defined(__need_ptrdiff_t) && !defined(__need_NULL)     \
 
48
     && !defined(__need_wint_t))
 
49
#define _STDDEF_H
 
50
#define _STDDEF_H_
 
51
/* snaroff@next.com says the NeXT needs this.  */
 
52
#define _ANSI_STDDEF_H
 
53
/* Irix 5.1 needs this.  */
 
54
#define __STDDEF_H__
 
55
#endif
 
56
 
 
57
#ifndef __sys_stdtypes_h
 
58
/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 
59
   defined if the corresponding type is *not* defined.
 
60
   FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
 
61
#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
 
62
#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
 
63
#define _SIZE_T
 
64
#endif
 
65
#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
 
66
#define _PTRDIFF_T
 
67
#endif
 
68
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
 
69
   instead of _WCHAR_T_. */
 
70
#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
 
71
#ifndef _BSD_WCHAR_T_
 
72
#define _WCHAR_T
 
73
#endif
 
74
#endif
 
75
/* Undef _FOO_T_ if we are supposed to define foo_t.  */
 
76
#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
 
77
#undef _PTRDIFF_T_
 
78
#undef _BSD_PTRDIFF_T_
 
79
#endif
 
80
#if defined (__need_size_t) || defined (_STDDEF_H_)
 
81
#undef _SIZE_T_
 
82
#undef _BSD_SIZE_T_
 
83
#endif
 
84
#if defined (__need_wchar_t) || defined (_STDDEF_H_)
 
85
#undef _WCHAR_T_
 
86
#undef _BSD_WCHAR_T_
 
87
#endif
 
88
#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
 
89
 
 
90
/* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 
91
   Just ignore it.  */
 
92
#if defined (__sequent__) && defined (_PTRDIFF_T_)
 
93
#undef _PTRDIFF_T_
 
94
#endif
 
95
 
 
96
/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
 
97
   _TYPE_size_t which will typedef size_t.  fixincludes patched the
 
98
   vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 
99
   not defined, and so that defining this macro defines _GCC_SIZE_T.
 
100
   If we find that the macros are still defined at this point, we must
 
101
   invoke them so that the type is defined as expected.  */
 
102
#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
 
103
_TYPE_ptrdiff_t;
 
104
#undef _TYPE_ptrdiff_t
 
105
#endif
 
106
#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
 
107
_TYPE_size_t;
 
108
#undef _TYPE_size_t
 
109
#endif
 
110
#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
 
111
_TYPE_wchar_t;
 
112
#undef _TYPE_wchar_t
 
113
#endif
 
114
 
 
115
/* In case nobody has defined these types, but we aren't running under
 
116
   GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 
117
   __WCHAR_TYPE__ have reasonable values.  This can happen if the
 
118
   parts of GCC is compiled by an older compiler, that actually
 
119
   include gstddef.h, such as collect2.  */
 
120
 
 
121
/* Signed type of difference of two pointers.  */
 
122
 
 
123
/* Define this type if we are doing the whole job,
 
124
   or if we want this type in particular.  */
 
125
#if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
 
126
#ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
 
127
#ifndef _T_PTRDIFF_
 
128
#ifndef _T_PTRDIFF
 
129
#ifndef __PTRDIFF_T
 
130
#ifndef _PTRDIFF_T_
 
131
#ifndef _BSD_PTRDIFF_T_
 
132
#ifndef ___int_ptrdiff_t_h
 
133
#ifndef _GCC_PTRDIFF_T
 
134
#define _PTRDIFF_T
 
135
#define _T_PTRDIFF_
 
136
#define _T_PTRDIFF
 
137
#define __PTRDIFF_T
 
138
#define _PTRDIFF_T_
 
139
#define _BSD_PTRDIFF_T_
 
140
#define ___int_ptrdiff_t_h
 
141
#define _GCC_PTRDIFF_T
 
142
#ifndef __PTRDIFF_TYPE__
 
143
#ifdef _WIN64
 
144
#define __PTRDIFF_TYPE__ long long int
 
145
#else
 
146
#define __PTRDIFF_TYPE__ long int
 
147
#endif
 
148
#endif
 
149
#ifndef _PTRDIFF_T_DEFINED
 
150
#define _PTRDIFF_T_DEFINED
 
151
__MINGW_EXTENSION typedef __PTRDIFF_TYPE__ ptrdiff_t;
 
152
#endif
 
153
#endif /* _GCC_PTRDIFF_T */
 
154
#endif /* ___int_ptrdiff_t_h */
 
155
#endif /* _BSD_PTRDIFF_T_ */
 
156
#endif /* _PTRDIFF_T_ */
 
157
#endif /* __PTRDIFF_T */
 
158
#endif /* _T_PTRDIFF */
 
159
#endif /* _T_PTRDIFF_ */
 
160
#endif /* _PTRDIFF_T */
 
161
 
 
162
/* If this symbol has done its job, get rid of it.  */
 
163
#undef  __need_ptrdiff_t
 
164
 
 
165
#endif /* _STDDEF_H or __need_ptrdiff_t.  */
 
166
 
 
167
/* Unsigned type of `sizeof' something.  */
 
168
 
 
169
/* Define this type if we are doing the whole job,
 
170
   or if we want this type in particular.  */
 
171
#if defined (_STDDEF_H) || defined (__need_size_t)
 
172
#ifndef __size_t__      /* BeOS */
 
173
#ifndef __SIZE_T__      /* Cray Unicos/Mk */
 
174
#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
 
175
#ifndef _SYS_SIZE_T_H
 
176
#ifndef _T_SIZE_
 
177
#ifndef _T_SIZE
 
178
#ifndef __SIZE_T
 
179
#ifndef _SIZE_T_
 
180
#ifndef _BSD_SIZE_T_
 
181
#ifndef _SIZE_T_DEFINED_
 
182
#ifndef _SIZE_T_DEFINED
 
183
#ifndef _BSD_SIZE_T_DEFINED_    /* Darwin */
 
184
#ifndef _SIZE_T_DECLARED        /* FreeBSD 5 */
 
185
#ifndef ___int_size_t_h
 
186
#ifndef _GCC_SIZE_T
 
187
#ifndef _SIZET_
 
188
#ifndef __size_t
 
189
#define __size_t__      /* BeOS */
 
190
#define __SIZE_T__      /* Cray Unicos/Mk */
 
191
#define _SIZE_T
 
192
#define _SYS_SIZE_T_H
 
193
#define _T_SIZE_
 
194
#define _T_SIZE
 
195
#define __SIZE_T
 
196
#define _SIZE_T_
 
197
#define _BSD_SIZE_T_
 
198
#define _SIZE_T_DEFINED_
 
199
#define _SIZE_T_DEFINED
 
200
#define _BSD_SIZE_T_DEFINED_    /* Darwin */
 
201
#define _SIZE_T_DECLARED        /* FreeBSD 5 */
 
202
#define ___int_size_t_h
 
203
#define _GCC_SIZE_T
 
204
#define _SIZET_
 
205
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
 
206
/* __size_t is a typedef on FreeBSD 5!, must not trash it. */
 
207
#else
 
208
#define __size_t
 
209
#endif
 
210
#ifndef __SIZE_TYPE__
 
211
#ifdef _WIN64
 
212
#define __SIZE_TYPE__ long long unsigned int
 
213
#else
 
214
#define __SIZE_TYPE__ long unsigned int
 
215
#endif
 
216
#endif
 
217
#if !(defined (__GNUG__) && defined (size_t))
 
218
__MINGW_EXTENSION typedef __SIZE_TYPE__ size_t;
 
219
#ifdef __BEOS__
 
220
typedef long ssize_t;
 
221
#endif /* __BEOS__ */
 
222
#endif /* !(defined (__GNUG__) && defined (size_t)) */
 
223
#endif /* __size_t */
 
224
#endif /* _SIZET_ */
 
225
#endif /* _GCC_SIZE_T */
 
226
#endif /* ___int_size_t_h */
 
227
#endif /* _SIZE_T_DECLARED */
 
228
#endif /* _BSD_SIZE_T_DEFINED_ */
 
229
#endif /* _SIZE_T_DEFINED */
 
230
#endif /* _SIZE_T_DEFINED_ */
 
231
#endif /* _BSD_SIZE_T_ */
 
232
#endif /* _SIZE_T_ */
 
233
#endif /* __SIZE_T */
 
234
#endif /* _T_SIZE */
 
235
#endif /* _T_SIZE_ */
 
236
#endif /* _SYS_SIZE_T_H */
 
237
#endif /* _SIZE_T */
 
238
#endif /* __SIZE_T__ */
 
239
#endif /* __size_t__ */
 
240
#undef  __need_size_t
 
241
#endif /* _STDDEF_H or __need_size_t.  */
 
242
 
 
243
 
 
244
/* Wide character type.
 
245
   Locale-writers should change this as necessary to
 
246
   be big enough to hold unique values not between 0 and 127,
 
247
   and not (wchar_t) -1, for each defined multibyte character.  */
 
248
 
 
249
/* Define this type if we are doing the whole job,
 
250
   or if we want this type in particular.  */
 
251
#if defined (_STDDEF_H) || defined (__need_wchar_t)
 
252
#ifndef __wchar_t__     /* BeOS */
 
253
#ifndef __WCHAR_T__     /* Cray Unicos/Mk */
 
254
#ifndef _WCHAR_T
 
255
#ifndef _T_WCHAR_
 
256
#ifndef _T_WCHAR
 
257
#ifndef __WCHAR_T
 
258
#ifndef _WCHAR_T_
 
259
#ifndef _BSD_WCHAR_T_
 
260
#ifndef _BSD_WCHAR_T_DEFINED_    /* Darwin */
 
261
#ifndef _BSD_RUNE_T_DEFINED_    /* Darwin */
 
262
#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
 
263
#ifndef _WCHAR_T_DEFINED_
 
264
#ifndef _WCHAR_T_DEFINED
 
265
#ifndef _WCHAR_T_H
 
266
#ifndef ___int_wchar_t_h
 
267
#ifndef __INT_WCHAR_T_H
 
268
#ifndef _GCC_WCHAR_T
 
269
#define __wchar_t__     /* BeOS */
 
270
#define __WCHAR_T__     /* Cray Unicos/Mk */
 
271
#define _WCHAR_T
 
272
#define _T_WCHAR_
 
273
#define _T_WCHAR
 
274
#define __WCHAR_T
 
275
#define _WCHAR_T_
 
276
#define _BSD_WCHAR_T_
 
277
#define _WCHAR_T_DEFINED_
 
278
#define _WCHAR_T_DEFINED
 
279
#define _WCHAR_T_H
 
280
#define ___int_wchar_t_h
 
281
#define __INT_WCHAR_T_H
 
282
#define _GCC_WCHAR_T
 
283
#define _WCHAR_T_DECLARED
 
284
 
 
285
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
 
286
   instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
 
287
   symbols in the _FOO_T_ family, stays defined even after its
 
288
   corresponding type is defined).  If we define wchar_t, then we
 
289
   must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
 
290
   we undef _WCHAR_T_, then we must also define rune_t, since 
 
291
   headers like runetype.h assume that if machine/ansi.h is included,
 
292
   and _BSD_WCHAR_T_ is not defined, then rune_t is available.
 
293
   machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
 
294
   the same type." */
 
295
#ifdef _BSD_WCHAR_T_
 
296
#undef _BSD_WCHAR_T_
 
297
#ifdef _BSD_RUNE_T_
 
298
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
 
299
typedef _BSD_RUNE_T_ rune_t;
 
300
#define _BSD_WCHAR_T_DEFINED_
 
301
#define _BSD_RUNE_T_DEFINED_    /* Darwin */
 
302
#if defined (__FreeBSD__) && (__FreeBSD__ < 5)
 
303
/* Why is this file so hard to maintain properly?  In contrast to
 
304
   the comment above regarding BSD/386 1.1, on FreeBSD for as long
 
305
   as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
 
306
   redundant typedefs will occur when stdlib.h is included after this file. */
 
307
#undef _BSD_RUNE_T_
 
308
#endif
 
309
#endif
 
310
#endif
 
311
#endif
 
312
 
 
313
#ifndef __WCHAR_TYPE__
 
314
/* wchar_t is unsigned short for compatibility with MS runtime */
 
315
#define __WCHAR_TYPE__ unsigned short
 
316
#endif
 
317
#ifndef __cplusplus
 
318
typedef __WCHAR_TYPE__ wchar_t;
 
319
#endif
 
320
#endif
 
321
#endif
 
322
#endif
 
323
#endif
 
324
#endif
 
325
#endif
 
326
#endif /* _WCHAR_T_DECLARED */
 
327
#endif /* _BSD_RUNE_T_DEFINED_ */
 
328
#endif
 
329
#endif
 
330
#endif
 
331
#endif
 
332
#endif
 
333
#endif
 
334
#endif
 
335
#endif /* __WCHAR_T__ */
 
336
#endif /* __wchar_t__ */
 
337
#undef  __need_wchar_t
 
338
#endif /* _STDDEF_H or __need_wchar_t.  */
 
339
 
 
340
#if defined (__need_wint_t)
 
341
#ifndef _WINT_T
 
342
#define _WINT_T
 
343
#ifndef __WINT_TYPE__
 
344
/* wint_t is unsigned short for compatibility with MS runtime */
 
345
#define __WINT_TYPE__ unsigned short
 
346
#endif
 
347
#ifndef _WCTYPE_T_DEFINED
 
348
#define _WCTYPE_T_DEFINED
 
349
  typedef __WINT_TYPE__ wint_t;
 
350
  typedef unsigned short wctype_t;
 
351
#endif
 
352
#endif
 
353
#undef __need_wint_t
 
354
#endif
 
355
 
 
356
/*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 
357
    are already defined.  */
 
358
/*  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.  */
 
359
#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
 
360
/*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
 
361
    are probably typos and should be removed before 2.8 is released.  */
 
362
#ifdef _GCC_PTRDIFF_T_
 
363
#undef _PTRDIFF_T_
 
364
#undef _BSD_PTRDIFF_T_
 
365
#endif
 
366
#ifdef _GCC_SIZE_T_
 
367
#undef _SIZE_T_
 
368
#undef _BSD_SIZE_T_
 
369
#endif
 
370
#ifdef _GCC_WCHAR_T_
 
371
#undef _WCHAR_T_
 
372
#undef _BSD_WCHAR_T_
 
373
#endif
 
374
/*  The following ones are the real ones.  */
 
375
#ifdef _GCC_PTRDIFF_T
 
376
#undef _PTRDIFF_T_
 
377
#undef _BSD_PTRDIFF_T_
 
378
#endif
 
379
#ifdef _GCC_SIZE_T
 
380
#undef _SIZE_T_
 
381
#undef _BSD_SIZE_T_
 
382
#endif
 
383
#ifdef _GCC_WCHAR_T
 
384
#undef _WCHAR_T_
 
385
#undef _BSD_WCHAR_T_
 
386
#endif
 
387
#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ */
 
388
 
 
389
#endif /* __sys_stdtypes_h */
 
390
 
 
391
/* A null pointer constant.  */
 
392
 
 
393
#if defined (_STDDEF_H) || defined (__need_NULL)
 
394
#undef NULL             /* in case <stdio.h> has defined it. */
 
395
#if defined(__GNUG__) && __GNUG__ >= 3
 
396
#define NULL __null
 
397
#else   /* G++ */
 
398
#ifndef __cplusplus
 
399
#define NULL ((void *)0)
 
400
#else   /* C++ */
 
401
#ifndef _WIN64
 
402
#define NULL 0
 
403
#else
 
404
#define NULL 0LL
 
405
#endif  /* W64 */
 
406
#endif  /* C++ */
 
407
#endif  /* G++ */
 
408
#endif  /* NULL not defined and <stddef.h> or need NULL.  */
 
409
#undef  __need_NULL
 
410
 
 
411
#ifdef _STDDEF_H
 
412
 
 
413
/* Offset of member MEMBER in a struct of type TYPE. */
 
414
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
 
415
 
 
416
#endif /* _STDDEF_H was defined this time.  */
 
417
 
 
418
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
 
419
          || __need_XXX was not defined before */
 
420