xref: /aosp_15_r20/external/coreboot/payloads/libpayload/include/stddef.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 #ifndef _STDDEF_H
2 #define _STDDEF_H
3 
4 #include <arch/types.h>
5 
6 #if !defined(offsetof)
7 #define offsetof(type, member) __builtin_offsetof(type, member)
8 #endif
9 
10 #ifndef __WCHAR_TYPE__
11 #define __WCHAR_TYPE__ int
12 #endif
13 #ifndef __cplusplus
14 typedef __WCHAR_TYPE__ wchar_t;
15 #endif
16 
17 #ifndef __SIZE_TYPE__
18 #define __SIZE_TYPE__ unsigned long
19 #endif
20 typedef __SIZE_TYPE__ size_t;
21 /* There is a GCC macro for a size_t type, but not
22  * for a ssize_t type. Below construct tricks GCC
23  * into making __SIZE_TYPE__ signed.
24  */
25 #define unsigned signed
26 typedef __SIZE_TYPE__ ssize_t;
27 #undef unsigned
28 
29 #endif
30