Add max_align_t to stddef.h
[tinycc.git] / include / stddef.h
blob06fbd9bd71dbdb80a048a0c43c4c4bd5fd6c1151
1 #ifndef _STDDEF_H
2 #define _STDDEF_H
4 typedef __SIZE_TYPE__ size_t;
5 typedef __PTRDIFF_TYPE__ ssize_t;
6 typedef __WCHAR_TYPE__ wchar_t;
7 typedef __PTRDIFF_TYPE__ ptrdiff_t;
8 typedef __PTRDIFF_TYPE__ intptr_t;
9 typedef __SIZE_TYPE__ uintptr_t;
11 typedef union { long long __ll; long double __ld; } max_align_t;
13 #ifndef __int8_t_defined
14 #define __int8_t_defined
15 typedef signed char int8_t;
16 typedef signed short int int16_t;
17 typedef signed int int32_t;
18 #ifdef __LP64__
19 typedef signed long int int64_t;
20 #else
21 typedef signed long long int int64_t;
22 #endif
23 typedef unsigned char uint8_t;
24 typedef unsigned short int uint16_t;
25 typedef unsigned int uint32_t;
26 #ifdef __LP64__
27 typedef unsigned long int uint64_t;
28 #else
29 typedef unsigned long long int uint64_t;
30 #endif
31 #endif
33 #ifndef NULL
34 #define NULL ((void*)0)
35 #endif
37 #define offsetof(type, field) ((size_t)&((type *)0)->field)
39 void *alloca(size_t size);
41 #endif
43 /* Older glibc require a wint_t from <stddef.h> (when requested
44 by __need_wint_t, as otherwise stddef.h isn't allowed to
45 define this type). Note that this must be outside the normal
46 _STDDEF_H guard, so that it works even when we've included the file
47 already (without requiring wint_t). Some other libs define _WINT_T
48 if they've already provided that type, so we can use that as guard.
49 TCC defines __WINT_TYPE__ for us. */
50 #if defined (__need_wint_t)
51 #ifndef _WINT_T
52 #define _WINT_T
53 typedef __WINT_TYPE__ wint_t;
54 #endif
55 #undef __need_wint_t
56 #endif