1 | /* A quick hack for freebsd where there are no separate location
|
---|
2 | for compiler specific headers like on linux, mingw, os2, ++.
|
---|
3 | This file will be cleaned up later... */
|
---|
4 |
|
---|
5 | #ifndef __nocrt_compiler_gcc_h__
|
---|
6 | #define __nocrt_compiler_gcc_h__
|
---|
7 |
|
---|
8 |
|
---|
9 | /* stddef.h */
|
---|
10 | #ifdef __PTRDIFF_TYPE__
|
---|
11 | typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
---|
12 | #elif ARCH_BITS == 32
|
---|
13 | typedef int32_t ptrdiff_t;
|
---|
14 | #elif ARCH_BITS == 64
|
---|
15 | typedef int64_t ptrdiff_t;
|
---|
16 | #else
|
---|
17 | # error "ARCH_BITS is undefined or incorrect."
|
---|
18 | #endif
|
---|
19 | #define _PTRDIFF_T_DECLARED
|
---|
20 |
|
---|
21 | #ifdef __SIZE_TYPE__
|
---|
22 | typedef __SIZE_TYPE__ size_t;
|
---|
23 | #elif ARCH_BITS == 32
|
---|
24 | typedef uint32_t size_t;
|
---|
25 | #elif ARCH_BITS == 64
|
---|
26 | typedef uint64_t size_t;
|
---|
27 | #else
|
---|
28 | # error "ARCH_BITS is undefined or incorrect."
|
---|
29 | #endif
|
---|
30 | #define _SIZE_T_DECLARED
|
---|
31 |
|
---|
32 | #ifndef __cplusplus
|
---|
33 | # ifdef __WCHAR_TYPE__
|
---|
34 | typedef __WCHAR_TYPE__ wchar_t;
|
---|
35 | # elif defined(__OS2__) || defined(__WIN__)
|
---|
36 | typedef uint16_t wchar_t;
|
---|
37 | # else
|
---|
38 | typedef int wchar_t;
|
---|
39 | # endif
|
---|
40 | # define _WCHAR_T_DECLARED
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #ifdef __WINT_TYPE__
|
---|
44 | typedef __WINT_TYPE__ wint_t;
|
---|
45 | #else
|
---|
46 | typedef unsigned int wint_t;
|
---|
47 | #endif
|
---|
48 | #define _WINT_T_DECLARED
|
---|
49 |
|
---|
50 | #ifndef NULL
|
---|
51 | # ifdef __cplusplus
|
---|
52 | # define NULL 0
|
---|
53 | # else
|
---|
54 | # define NULL ((void *)0)
|
---|
55 | # endif
|
---|
56 | #endif
|
---|
57 |
|
---|
58 |
|
---|
59 | #ifndef offsetof
|
---|
60 | # if defined(__cplusplus) && defined(__offsetof__)
|
---|
61 | # define offsetof(type, memb)
|
---|
62 | (__offsetof__ (reinterpret_cast<size_t>(&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->memb))) )
|
---|
63 | # else
|
---|
64 | # define offsetof(type, memb) ((size_t)&((type *)0)->memb)
|
---|
65 | # endif
|
---|
66 | #endif
|
---|
67 |
|
---|
68 |
|
---|
69 | /* sys/types.h */
|
---|
70 | #ifdef __SSIZE_TYPE__
|
---|
71 | typedef __SSIZE_TYPE__ ssize_t;
|
---|
72 | #elif ARCH_BITS == 32
|
---|
73 | typedef int32_t ssize_t;
|
---|
74 | #elif ARCH_BITS == 64
|
---|
75 | typedef int64_t ssize_t;
|
---|
76 | #else
|
---|
77 | # define ARCH_BITS 123123
|
---|
78 | # error "ARCH_BITS is undefined or incorrect."
|
---|
79 | #endif
|
---|
80 | #define _SSIZE_T_DECLARED
|
---|
81 |
|
---|
82 |
|
---|
83 | /* stdarg.h */
|
---|
84 | typedef __builtin_va_list va_list;
|
---|
85 | #define va_start(va, arg) __builtin_va_start(va, arg)
|
---|
86 | #define va_end(va) __builtin_va_end(va)
|
---|
87 | #define va_arg(va, type) __builtin_va_arg(va, type)
|
---|
88 | #define va_copy(dst, src) __builtin_va_copy(dst, src)
|
---|
89 |
|
---|
90 |
|
---|
91 | #endif
|
---|