scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 33f6a64348fbdae4298a057cf134969f78a57f86
parent 5322cbec9cd0fc0212a87e4b24ff73fa28133c94
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu, 23 Feb 2017 20:02:20 +0100

[libc] Define NULL in common headers

There's no need to define NULL per architecture, it'll be the same for
all the ones we support.

Diffstat:
Dlibc/include/bits/amd64-sysv/arch/locale.h | 4----
Mlibc/include/bits/amd64-sysv/arch/stddef.h | 6+-----
Mlibc/include/bits/amd64-sysv/arch/stdio.h | 3---
Mlibc/include/bits/amd64-sysv/arch/stdlib.h | 4----
Mlibc/include/bits/amd64-sysv/arch/string.h | 4----
Mlibc/include/bits/amd64-sysv/arch/time.h | 3---
Dlibc/include/bits/i386-sysv/arch/locale.h | 4----
Mlibc/include/bits/i386-sysv/arch/stddef.h | 6+-----
Mlibc/include/bits/i386-sysv/arch/stdio.h | 3---
Mlibc/include/bits/i386-sysv/arch/stdlib.h | 4----
Mlibc/include/bits/i386-sysv/arch/string.h | 4----
Mlibc/include/bits/i386-sysv/arch/time.h | 3---
Dlibc/include/bits/qbe/arch/locale.h | 4----
Mlibc/include/bits/qbe/arch/stddef.h | 6+-----
Mlibc/include/bits/qbe/arch/stdio.h | 3---
Mlibc/include/bits/qbe/arch/stdlib.h | 4----
Mlibc/include/bits/qbe/arch/string.h | 4----
Mlibc/include/bits/qbe/arch/time.h | 3---
Dlibc/include/bits/z80/arch/locale.h | 4----
Mlibc/include/bits/z80/arch/stddef.h | 4----
Mlibc/include/bits/z80/arch/stdio.h | 3---
Mlibc/include/bits/z80/arch/stdlib.h | 4----
Mlibc/include/bits/z80/arch/string.h | 4----
Mlibc/include/bits/z80/arch/time.h | 3---
Mlibc/include/locale.h | 4+++-
Mlibc/include/stddef.h | 4++++
Mlibc/include/stdio.h | 4++++
Mlibc/include/stdlib.h | 4++++
Mlibc/include/string.h | 4++++
Mlibc/include/time.h | 4++++
30 files changed, 26 insertions(+), 92 deletions(-)

diff --git a/libc/include/bits/amd64-sysv/arch/locale.h b/libc/include/bits/amd64-sysv/arch/locale.h @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif diff --git a/libc/include/bits/amd64-sysv/arch/stddef.h b/libc/include/bits/amd64-sysv/arch/stddef.h @@ -1,16 +1,12 @@ /* 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; +typedef short wchar_t; #define _WCHAR_T #endif diff --git a/libc/include/bits/amd64-sysv/arch/stdio.h b/libc/include/bits/amd64-sysv/arch/stdio.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/amd64-sysv/arch/stdlib.h b/libc/include/bits/amd64-sysv/arch/stdlib.h @@ -5,10 +5,6 @@ typedef unsigned long size_t; #define _SIZET #endif -#ifndef NULL -#define NULL ((void *) 0) -#endif - #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 diff --git a/libc/include/bits/amd64-sysv/arch/string.h b/libc/include/bits/amd64-sysv/arch/string.h @@ -1,9 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifndef _SIZET typedef unsigned long size_t; #endif diff --git a/libc/include/bits/amd64-sysv/arch/time.h b/libc/include/bits/amd64-sysv/arch/time.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/i386-sysv/arch/locale.h b/libc/include/bits/i386-sysv/arch/locale.h @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif diff --git a/libc/include/bits/i386-sysv/arch/stddef.h b/libc/include/bits/i386-sysv/arch/stddef.h @@ -1,16 +1,12 @@ /* 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; +typedef short wchar_t; #define _WCHAR_T #endif diff --git a/libc/include/bits/i386-sysv/arch/stdio.h b/libc/include/bits/i386-sysv/arch/stdio.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/i386-sysv/arch/stdlib.h b/libc/include/bits/i386-sysv/arch/stdlib.h @@ -5,10 +5,6 @@ typedef unsigned long size_t; #define _SIZET #endif -#ifndef NULL -#define NULL ((void *) 0) -#endif - #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 diff --git a/libc/include/bits/i386-sysv/arch/string.h b/libc/include/bits/i386-sysv/arch/string.h @@ -1,9 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifndef _SIZET typedef unsigned long size_t; #endif diff --git a/libc/include/bits/i386-sysv/arch/time.h b/libc/include/bits/i386-sysv/arch/time.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/qbe/arch/locale.h b/libc/include/bits/qbe/arch/locale.h @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif diff --git a/libc/include/bits/qbe/arch/stddef.h b/libc/include/bits/qbe/arch/stddef.h @@ -1,16 +1,12 @@ /* 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; +typedef short wchar_t; #define _WCHAR_T #endif diff --git a/libc/include/bits/qbe/arch/stdio.h b/libc/include/bits/qbe/arch/stdio.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/qbe/arch/stdlib.h b/libc/include/bits/qbe/arch/stdlib.h @@ -5,10 +5,6 @@ typedef unsigned long size_t; #define _SIZET #endif -#ifndef NULL -#define NULL ((void *) 0) -#endif - #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 diff --git a/libc/include/bits/qbe/arch/string.h b/libc/include/bits/qbe/arch/string.h @@ -1,9 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifndef _SIZET typedef unsigned long size_t; #endif diff --git a/libc/include/bits/qbe/arch/time.h b/libc/include/bits/qbe/arch/time.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned long size_t; diff --git a/libc/include/bits/z80/arch/locale.h b/libc/include/bits/z80/arch/locale.h @@ -1,4 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif diff --git a/libc/include/bits/z80/arch/stddef.h b/libc/include/bits/z80/arch/stddef.h @@ -1,9 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifndef _SIZET typedef unsigned size_t; #define _SIZET diff --git a/libc/include/bits/z80/arch/stdio.h b/libc/include/bits/z80/arch/stdio.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned size_t; diff --git a/libc/include/bits/z80/arch/stdlib.h b/libc/include/bits/z80/arch/stdlib.h @@ -5,10 +5,6 @@ typedef unsigned size_t; #define _SIZET #endif -#ifndef NULL -#define NULL ((void *) 0) -#endif - #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 diff --git a/libc/include/bits/z80/arch/string.h b/libc/include/bits/z80/arch/string.h @@ -1,9 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifndef _SIZET typedef unsigned size_t; #endif diff --git a/libc/include/bits/z80/arch/time.h b/libc/include/bits/z80/arch/time.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#ifndef NULL -#define NULL ((void *) 0) -#endif #ifndef _SIZET typedef unsigned size_t; diff --git a/libc/include/locale.h b/libc/include/locale.h @@ -1,7 +1,9 @@ #ifndef _LOCALE_H #define _LOCALE_H -#include <arch/locale.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif #define LC_ALL 0 #define LC_COLLATE 1 diff --git a/libc/include/stddef.h b/libc/include/stddef.h @@ -4,6 +4,10 @@ #include <arch/stddef.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif + #define offsetof(st, m) ((size_t)&(((st *)0)->m)) #endif diff --git a/libc/include/stdio.h b/libc/include/stdio.h @@ -4,6 +4,10 @@ #include <arch/stdio.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif + #define EOF -1 #define _IOFBF 0 #define _IOLBF 1 diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h @@ -4,6 +4,10 @@ #include <arch/stdlib.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif + #define MB_CUR_MAX 1 #define RAND_MAX 32767 diff --git a/libc/include/string.h b/libc/include/string.h @@ -4,6 +4,10 @@ #include <arch/string.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif + extern void *memcpy(void * restrict s1, const void * restrict s2, size_t n); extern void *memmove(void *s1, const void *s2, size_t n); extern char *strcpy(char * restrict s1, const char * restrict s2); diff --git a/libc/include/time.h b/libc/include/time.h @@ -3,6 +3,10 @@ #include <arch/time.h> +#ifndef NULL +#define NULL ((void *) 0) +#endif + #define CLOCKS_PER_SEC 1000000 typedef long int clock_t;