commit 7030f8afe36ad641a56f101660b6256ca81c5b6b
parent 6442b309804938d003a83b2d1bd8cb42e972c7f5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 17 Feb 2017 15:01:15 +0100
[libc] Add stddef.h
Diffstat:
5 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/libc/include/bits/amd64-sysv/arch/stddef.h b/libc/include/bits/amd64-sysv/arch/stddef.h
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef unsigned long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
diff --git a/libc/include/bits/i386-sysv/arch/stddef.h b/libc/include/bits/i386-sysv/arch/stddef.h
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef unsigned long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
diff --git a/libc/include/bits/qbe/arch/stddef.h b/libc/include/bits/qbe/arch/stddef.h
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef unsigned long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
diff --git a/libc/include/bits/z80/arch/stddef.h b/libc/include/bits/z80/arch/stddef.h
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned short size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef unsigned short ptrdiff_t;
+#define _PTRDIFF_T
+#endif
diff --git a/libc/include/stddef.h b/libc/include/stddef.h
@@ -0,0 +1,9 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#include <arch/stddef.h>
+
+#define offsetof(st, m) ((size_t)&(((st *)0)->m))
+
+#endif