Documentation/releases: Add 4.15 release notes template
[coreboot.git] / src / include / stddef.h
blobb668b1aeb642ab759589171d96aa5baedc60af2a
1 #ifndef STDDEF_H
2 #define STDDEF_H
4 #include <commonlib/helpers.h>
6 typedef long ptrdiff_t;
7 #ifndef __SIZE_TYPE__
8 #define __SIZE_TYPE__ unsigned long
9 #endif
10 typedef __SIZE_TYPE__ size_t;
11 /* There is a GCC macro for a size_t type, but not
12 * for a ssize_t type. Below construct tricks GCC
13 * into making __SIZE_TYPE__ signed.
15 #define unsigned signed
16 typedef __SIZE_TYPE__ ssize_t;
17 #undef unsigned
19 typedef int wchar_t;
20 typedef unsigned int wint_t;
22 #define NULL ((void *)0)
24 /* The devicetree data structures are only mutable in ramstage. All other
25 stages have a constant devicetree. */
26 #if !ENV_PAYLOAD_LOADER
27 #define DEVTREE_EARLY 1
28 #else
29 #define DEVTREE_EARLY 0
30 #endif
32 #if DEVTREE_EARLY
33 #define DEVTREE_CONST const
34 #else
35 #define DEVTREE_CONST
36 #endif
38 #if ENV_STAGE_HAS_DATA_SECTION
39 #define MAYBE_STATIC_NONZERO static
40 #else
41 #define MAYBE_STATIC_NONZERO
42 #endif
44 /* Provide a pointer to address 0 that thwarts any "accessing this is
45 * undefined behaviour and do whatever" trickery in compilers.
46 * Use when you _really_ need to read32(zeroptr) (ie. read address 0).
48 extern char zeroptr[];
50 #endif /* STDDEF_H */