shithub: scc

Download patch

ref: 5eb497b0e16849c52bc45af5a7a5813c779da0e0
parent: 522661a7fb8fd6564b280de135ca77bc1ac8d53d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Nov 29 08:25:17 EST 2016

[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.

--- 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
  */
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -9,19 +9,20 @@
 
 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 $@
--- a/cc2/arch/amd64-sysv/arch.h
+++ b/cc2/arch/amd64-sysv/arch.h
@@ -1,4 +1,1 @@
 /* See LICENSE file for copyright and license details. */
-#define TINT    long long
-#define TUINT   unsigned long long
-#define TFLOAT  double
--- 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 *
--- 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"
 
--- 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 *
--- 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"
 
 
--- a/cc2/arch/i386-sysv/arch.h
+++ b/cc2/arch/i386-sysv/arch.h
@@ -1,4 +1,1 @@
 /* See LICENSE file for copyright and license details. */
-#define TINT    long long
-#define TUINT   unsigned long long
-#define TFLOAT  double
--- 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 *
--- 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"
 
--- 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 *
--- 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"
 
 
--- 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,
--- 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"
 
--- 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"
 
--- 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 *
--- 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"
 
 
--- a/cc2/arch/z80/arch.h
+++ b/cc2/arch/z80/arch.h
@@ -1,4 +1,1 @@
 /* See LICENSE file for copyright and license details. */
-#define TINT    long long
-#define TUINT   unsigned long long
-#define TFLOAT  double
--- 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 *
--- 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"
 
--- 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 *
--- 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"
 
 
--- 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;
--- 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"
 
--- 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
--- a/cc2/optm.c
+++ b/cc2/optm.c
@@ -1,5 +1,5 @@
 
-#include "arch.h"
+#include "../inc/cc.h"
 #include "cc2.h"
 
 Node *
--- 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
--- 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
--- 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
--- a/inc/cc.h
+++ b/inc/cc.h
@@ -14,6 +14,10 @@
 #define PREFIX "/usr/local/"
 #endif
 
+#define TINT        long long
+#define TUINT       unsigned long long
+#define TFLOAT      double
+
 struct items {
 	char **s;
 	unsigned n;