scc

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

commit 48f5c933ab39f441a2d488e74769fd318be12c73
parent 1a4f8f084bb2e93c7fec86283a4ae09ebdf7aa62
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 10 Dec 2016 12:56:39 +0100

Replace sizes.h with cstd.h

And get rid of the file copy of the header, use include path instead.

Diffstat:
MMakefile | 1-
Mcc1/Makefile | 7+++----
Mcc1/cpp.c | 2+-
Mcc1/decl.c | 2+-
Mcc1/expr.c | 2+-
Mcc1/init.c | 2+-
Mcc1/lex.c | 2+-
Mcc1/stmt.c | 2+-
Mcc1/symbol.c | 2+-
Mcc1/types.c | 2+-
Mcc2/Makefile | 7+++----
Mcc2/arch/amd64-sysv/code.c | 2+-
Mcc2/arch/i386-sysv/code.c | 2+-
Mcc2/arch/qbe/cgen.c | 2+-
Mcc2/arch/qbe/code.c | 2+-
Mcc2/arch/z80/code.c | 2+-
Mcc2/parser.c | 2+-
Mconfig.mk | 4++--
Rinc/sizes_c89.h -> inc/c89/cstd.h | 0
Rinc/sizes_c99.h -> inc/c99/cstd.h | 0
20 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/Makefile b/Makefile @@ -60,4 +60,3 @@ clean: distclean: clean rm -rf bin - rm inc/sizes.h diff --git a/cc1/Makefile b/cc1/Makefile @@ -1,6 +1,8 @@ # See LICENSE file for copyright and license details. .POSIX: +CSTDINC = -I../inc/$(STD) + include ../config.mk OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \ @@ -9,10 +11,7 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \ all: cc1-$(ARCH) cpp.o: stallman.msg -$(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h - -../inc/sizes.h: - cp ../inc/sizes_$(STD).h $@ +$(OBJS): cc1.h ../inc/cc.h ../inc/$(STD)/cstd.h ../lib/libcc.a: cd ../lib && $(MAKE) -e diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -7,7 +7,7 @@ static char sccsid[] = "@(#) ./cc1/cpp.c"; #include <string.h> #include <time.h> -#include "../inc/sizes.h" +#include <cstd.h> #include "../inc/cc.h" #include "cc1.h" diff --git a/cc1/decl.c b/cc1/decl.c @@ -6,7 +6,7 @@ static char sccsid[] = "@(#) ./cc1/decl.c"; #include <stdlib.h> #include <string.h> -#include "../inc/sizes.h" +#include <cstd.h> #include "../inc/cc.h" #include "cc1.h" diff --git a/cc1/expr.c b/cc1/expr.c @@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/expr.c"; #include <stdlib.h> #include <string.h> +#include <cstd.h> #include "../inc/cc.h" -#include "../inc/sizes.h" #include "cc1.h" #define XCHG(lp, rp, np) (np = lp, lp = rp, rp = np) diff --git a/cc1/init.c b/cc1/init.c @@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/init.c"; #include <stdlib.h> #include <string.h> +#include <cstd.h> #include "../inc/cc.h" -#include "../inc/sizes.h" #include "cc1.h" diff --git a/cc1/lex.c b/cc1/lex.c @@ -7,7 +7,7 @@ static char sccsid[] = "@(#) ./cc1/lex.c"; #include <stdlib.h> #include <string.h> -#include "../inc/sizes.h" +#include <cstd.h> #include "../inc/cc.h" #include "cc1.h" diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -4,8 +4,8 @@ static char sccsid[] = "@(#) ./cc1/stmt.c"; #include <setjmp.h> #include <stdio.h> +#include <cstd.h> #include "../inc/cc.h" -#include "../inc/sizes.h" #include "cc1.h" Symbol *curfun; diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/symbol.c"; #include <stdlib.h> #include <string.h> +#include <cstd.h> #include "../inc/cc.h" -#include "../inc/sizes.h" #include "cc1.h" #define NR_SYM_HASH 64 diff --git a/cc1/types.c b/cc1/types.c @@ -5,7 +5,7 @@ static char sccsid[] = "@(#) ./cc1/types.c"; #include <stdlib.h> #include <string.h> -#include "../inc/sizes.h" +#include <cstd.h> #include "../inc/cc.h" #include "cc1.h" diff --git a/cc2/Makefile b/cc2/Makefile @@ -1,6 +1,8 @@ # See LICENSE file for copyright and license details. .POSIX: +CSTDINC = -I../inc/$(STD) + include ../config.mk OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\ @@ -10,7 +12,7 @@ OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\ all: cc2-$(ARCH) main.o: error.h -$(OBJS): cc2.h ../inc/sizes.h ../inc/cc.h +$(OBJS): cc2.h ../inc/$(STD)/cstd.h ../inc/cc.h arch/$(ARCH)/code.o: arch/$(ARCH)/arch.h arch/$(ARCH)/cgen.o: arch/$(ARCH)/arch.h @@ -21,9 +23,6 @@ error.h: cc2.h ../lib/libcc.a: cd ../lib && $(MAKE) -e -../inc/sizes.h: - cp ../inc/sizes_$(STD).h $@ - cc2-$(ARCH): $(OBJS) ../lib/libcc.a $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@ diff --git a/cc2/arch/amd64-sysv/code.c b/cc2/arch/amd64-sysv/code.c @@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/code.c"; #include <stdio.h> #include <stdlib.h> +#include <cstd.h> #include "arch.h" #include "../../../inc/cc.h" #include "../../cc2.h" -#include "../../../inc/sizes.h" enum segment { CODESEG, diff --git a/cc2/arch/i386-sysv/code.c b/cc2/arch/i386-sysv/code.c @@ -3,10 +3,10 @@ static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/code.c"; #include <stdio.h> #include <stdlib.h> +#include <cstd.h> #include "arch.h" #include "../../../inc/cc.h" #include "../../cc2.h" -#include "../../../inc/sizes.h" enum segment { CODESEG, diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/qbe/cgen.c"; #include <assert.h> #include <stdlib.h> +#include <cstd.h> #include "arch.h" #include "../../../inc/cc.h" #include "../../cc2.h" -#include "../../../inc/sizes.h" enum sflags { ISTMP = 1, diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c @@ -5,10 +5,10 @@ static char sccsid[] = "@(#) ./cc2/arch/qbe/code.c"; #include <stdlib.h> #include <string.h> +#include <cstd.h> #include "arch.h" #include "../../../inc/cc.h" #include "../../cc2.h" -#include "../../../inc/sizes.h" #define ADDR_LEN (INTIDENTSIZ+64) diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c @@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/z80/code.c"; #include <stdio.h> #include <stdlib.h> +#include <cstd.h> #include "arch.h" #include "../../../inc/cc.h" #include "../../cc2.h" -#include "../../../inc/sizes.h" enum segment { CODESEG, diff --git a/cc2/parser.c b/cc2/parser.c @@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc2/parser.c"; #include <stdlib.h> #include <string.h> +#include <cstd.h> #include "../inc/cc.h" -#include "../inc/sizes.h" #include "cc2.h" diff --git a/config.mk b/config.mk @@ -7,8 +7,7 @@ ARCHS = z80 i386-sysv amd64-sysv qbe ARCH = qbe DRIVER = posix -# Remove inc/sizes.h if STD is changed -# can be c89 or c99 +# Can be c89 or c99 STD = c99 # paths @@ -21,6 +20,7 @@ MANPREFIX = $(PREFIX)/share/man # for Plan9 add -D_SUSV2_SOURCE SCC_CFLAGS = -DARCH=\"$(ARCH)\" \ + $(CSTDINC) \ -DPREFIX=\"$(PREFIX)\" \ -DNDEBUG \ $(CFLAGS) diff --git a/inc/sizes_c89.h b/inc/c89/cstd.h diff --git a/inc/sizes_c99.h b/inc/c99/cstd.h