scc

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

commit b1ab56147455451330f284bf37d227cd42e97715
parent 7970e948796bc1670bba5c5cad6130d1ddd2d059
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 29 Nov 2016 13:25:17 +0100

[cc2] Remove dependency in common objects to arch.h

After this change the common objects of cc1 and cc2 does not
depend of the any architecture header, so they can be reused
without any clean.

Diffstat:
Mcc1/cc1.h | 5-----
Mcc2/Makefile | 13+++++++------
Mcc2/arch/amd64-sysv/arch.h | 3---
Mcc2/arch/amd64-sysv/cgen.c | 2++
Mcc2/arch/amd64-sysv/code.c | 2++
Mcc2/arch/amd64-sysv/optm.c | 3++-
Mcc2/arch/amd64-sysv/types.c | 3++-
Mcc2/arch/i386-sysv/arch.h | 3---
Mcc2/arch/i386-sysv/cgen.c | 2++
Mcc2/arch/i386-sysv/code.c | 1+
Mcc2/arch/i386-sysv/optm.c | 3++-
Mcc2/arch/i386-sysv/types.c | 3++-
Mcc2/arch/qbe/arch.h | 3---
Mcc2/arch/qbe/cgen.c | 2++
Mcc2/arch/qbe/code.c | 2++
Mcc2/arch/qbe/optm.c | 3++-
Mcc2/arch/qbe/types.c | 3++-
Mcc2/arch/z80/arch.h | 3---
Mcc2/arch/z80/cgen.c | 2++
Mcc2/arch/z80/code.c | 2++
Mcc2/arch/z80/optm.c | 3++-
Mcc2/arch/z80/types.c | 3++-
Mcc2/code.c | 1-
Mcc2/main.c | 1-
Mcc2/node.c | 1-
Mcc2/optm.c | 2+-
Mcc2/parser.c | 1-
Mcc2/peep.c | 2+-
Mcc2/symbol.c | 1-
Minc/cc.h | 4++++
30 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -6,11 +6,6 @@ #define NR_USWITCHES 20 -#define TINT long long -#define TUINT unsigned long long -#define TFLOAT double - - /* * Definition of enumerations */ diff --git a/cc2/Makefile b/cc2/Makefile @@ -9,20 +9,21 @@ OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\ all: cc2 +main.o: error.h +$(OBJS): cc2.h ../inc/sizes.h ../inc/cc.h +arch/$(ARCH)/code.o: arch/$(ARCH)/arch.h +arch/$(ARCH)/cgen.o: arch/$(ARCH)/arch.h + error.h: cc2.h rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT ;\ awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@ -main.o: error.h +../lib/libcc.a: + cd ../lib && $(MAKE) -e ../inc/sizes.h: cp ../inc/sizes_$(STD).h $@ -$(OBJS): cc2.h ../inc/sizes.h - -../lib/libcc.a: - cd ../lib && $(MAKE) -e - cc2: $(OBJS) ../lib/libcc.a $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@ diff --git a/cc2/arch/amd64-sysv/arch.h b/cc2/arch/amd64-sysv/arch.h @@ -1,4 +1 @@ /* See LICENSE file for copyright and license details. */ -#define TINT long long -#define TUINT unsigned long long -#define TFLOAT double diff --git a/cc2/arch/amd64-sysv/cgen.c b/cc2/arch/amd64-sysv/cgen.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ + #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/amd64-sysv/code.c b/cc2/arch/amd64-sysv/code.c @@ -1,8 +1,10 @@ /* See LICENSE file for copyright and license details. */ + #include <stdio.h> #include <stdlib.h> #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" #include "../../../inc/sizes.h" diff --git a/cc2/arch/amd64-sysv/optm.c b/cc2/arch/amd64-sysv/optm.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/amd64-sysv/types.c b/cc2/arch/amd64-sysv/types.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" diff --git a/cc2/arch/i386-sysv/arch.h b/cc2/arch/i386-sysv/arch.h @@ -1,4 +1 @@ /* See LICENSE file for copyright and license details. */ -#define TINT long long -#define TUINT unsigned long long -#define TFLOAT double diff --git a/cc2/arch/i386-sysv/cgen.c b/cc2/arch/i386-sysv/cgen.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ + #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/i386-sysv/code.c b/cc2/arch/i386-sysv/code.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" #include "../../../inc/sizes.h" diff --git a/cc2/arch/i386-sysv/optm.c b/cc2/arch/i386-sysv/optm.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/i386-sysv/types.c b/cc2/arch/i386-sysv/types.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" diff --git a/cc2/arch/qbe/arch.h b/cc2/arch/qbe/arch.h @@ -1,7 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#define TINT long long -#define TUINT unsigned long long -#define TFLOAT double enum asmop { ASNOP = 0, diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -1,8 +1,10 @@ /* See LICENSE file for copyright and license details. */ + #include <assert.h> #include <stdlib.h> #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" #include "../../../inc/sizes.h" diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c @@ -1,9 +1,11 @@ /* See LICENSE file for copyright and license details. */ + #include <stdio.h> #include <stdlib.h> #include <string.h> #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" #include "../../../inc/sizes.h" diff --git a/cc2/arch/qbe/optm.c b/cc2/arch/qbe/optm.c @@ -1,7 +1,8 @@ /* See LICENSE file for copyright and license details. */ + #include <stddef.h> -#include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/qbe/types.c b/cc2/arch/qbe/types.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" diff --git a/cc2/arch/z80/arch.h b/cc2/arch/z80/arch.h @@ -1,4 +1 @@ /* See LICENSE file for copyright and license details. */ -#define TINT long long -#define TUINT unsigned long long -#define TFLOAT double diff --git a/cc2/arch/z80/cgen.c b/cc2/arch/z80/cgen.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ + #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c @@ -1,8 +1,10 @@ /* See LICENSE file for copyright and license details. */ + #include <stdio.h> #include <stdlib.h> #include "arch.h" +#include "../../../inc/cc.h" #include "../../cc2.h" #include "../../../inc/sizes.h" diff --git a/cc2/arch/z80/optm.c b/cc2/arch/z80/optm.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" Node * diff --git a/cc2/arch/z80/types.c b/cc2/arch/z80/types.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" + +#include "../../../inc/cc.h" #include "../../cc2.h" diff --git a/cc2/code.c b/cc2/code.c @@ -3,7 +3,6 @@ #include <string.h> #include "../inc/cc.h" -#include "arch.h" #include "cc2.h" Inst *pc, *prog; diff --git a/cc2/main.c b/cc2/main.c @@ -4,7 +4,6 @@ #include <stdlib.h> #include "../inc/cc.h" -#include "arch.h" #include "cc2.h" #include "error.h" diff --git a/cc2/node.c b/cc2/node.c @@ -4,7 +4,6 @@ #include "../inc/cc.h" -#include "arch.h" #include "cc2.h" #define NNODES 32 diff --git a/cc2/optm.c b/cc2/optm.c @@ -1,5 +1,5 @@ -#include "arch.h" +#include "../inc/cc.h" #include "cc2.h" Node * diff --git a/cc2/parser.c b/cc2/parser.c @@ -7,7 +7,6 @@ #include "../inc/cc.h" #include "../inc/sizes.h" -#include "arch.h" #include "cc2.h" #define MAXLINE 200 diff --git a/cc2/peep.c b/cc2/peep.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "arch.h" +#include "../inc/cc.h" #include "cc2.h" void diff --git a/cc2/symbol.c b/cc2/symbol.c @@ -6,7 +6,6 @@ #include "../inc/cc.h" -#include "arch.h" #include "cc2.h" #define NR_SYMHASH 64 diff --git a/inc/cc.h b/inc/cc.h @@ -14,6 +14,10 @@ extern int debug; #define PREFIX "/usr/local/" #endif +#define TINT long long +#define TUINT unsigned long long +#define TFLOAT double + struct items { char **s; unsigned n;