[hackers] [scc] [cc2] Remove dependency in common objects to arch.h || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 29 Nov 2016 13:42:25 +0100 (CET)

commit b1ab56147455451330f284bf37d227cd42e97715
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Nov 29 13:25:17 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Nov 29 13:25:17 2016 +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.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index 12b73f4..9ded21e 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -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
index c6ed72e..ee0f35d 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -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 $_AT_; trap 'rm -f $$$$.h' EXIT INT QUIT ;\
         awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $_AT_
 
-main.o: error.h
+../lib/libcc.a:
+ cd ../lib && $(MAKE) -e
 
 ../inc/sizes.h:
         cp ../inc/sizes_$(STD).h $_AT_
 
-$(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 $_AT_
 
diff --git a/cc2/arch/amd64-sysv/arch.h b/cc2/arch/amd64-sysv/arch.h
index f5c4b7c..e96a098 100644
--- a/cc2/arch/amd64-sysv/arch.h
+++ b/cc2/arch/amd64-sysv/arch.h
_AT_@ -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
index 1fbb340..8270448 100644
--- a/cc2/arch/amd64-sysv/cgen.c
+++ b/cc2/arch/amd64-sysv/cgen.c
_AT_@ -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
index cc006f5..2d9740a 100644
--- a/cc2/arch/amd64-sysv/code.c
+++ b/cc2/arch/amd64-sysv/code.c
_AT_@ -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
index 6764c1d..8097b4d 100644
--- a/cc2/arch/amd64-sysv/optm.c
+++ b/cc2/arch/amd64-sysv/optm.c
_AT_@ -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
index c67d365..7ab3ee1 100644
--- a/cc2/arch/amd64-sysv/types.c
+++ b/cc2/arch/amd64-sysv/types.c
_AT_@ -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
index f5c4b7c..e96a098 100644
--- a/cc2/arch/i386-sysv/arch.h
+++ b/cc2/arch/i386-sysv/arch.h
_AT_@ -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
index 1fbb340..8270448 100644
--- a/cc2/arch/i386-sysv/cgen.c
+++ b/cc2/arch/i386-sysv/cgen.c
_AT_@ -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
index 5df3428..47d13a0 100644
--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
_AT_@ -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
index 6764c1d..8097b4d 100644
--- a/cc2/arch/i386-sysv/optm.c
+++ b/cc2/arch/i386-sysv/optm.c
_AT_@ -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
index f92540f..92f0034 100644
--- a/cc2/arch/i386-sysv/types.c
+++ b/cc2/arch/i386-sysv/types.c
_AT_@ -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
index 11cb945..7c86252 100644
--- a/cc2/arch/qbe/arch.h
+++ b/cc2/arch/qbe/arch.h
_AT_@ -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
index 3deb1e4..a59f312 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -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
index 9823644..a931620 100644
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
_AT_@ -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
index 929d976..5e0d082 100644
--- a/cc2/arch/qbe/optm.c
+++ b/cc2/arch/qbe/optm.c
_AT_@ -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
index c67d365..7ab3ee1 100644
--- a/cc2/arch/qbe/types.c
+++ b/cc2/arch/qbe/types.c
_AT_@ -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
index f5c4b7c..e96a098 100644
--- a/cc2/arch/z80/arch.h
+++ b/cc2/arch/z80/arch.h
_AT_@ -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
index 016e456..f1dfee4 100644
--- a/cc2/arch/z80/cgen.c
+++ b/cc2/arch/z80/cgen.c
_AT_@ -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
index d2bb06e..541516c 100644
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
_AT_@ -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
index 6764c1d..8097b4d 100644
--- a/cc2/arch/z80/optm.c
+++ b/cc2/arch/z80/optm.c
_AT_@ -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
index 129bd13..cc491c6 100644
--- a/cc2/arch/z80/types.c
+++ b/cc2/arch/z80/types.c
_AT_@ -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
index 35c9cf1..853841f 100644
--- a/cc2/code.c
+++ b/cc2/code.c
_AT_@ -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
index 924f862..d6a4d7a 100644
--- a/cc2/main.c
+++ b/cc2/main.c
_AT_@ -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
index 7306722..0ab366b 100644
--- a/cc2/node.c
+++ b/cc2/node.c
_AT_@ -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
index c70380b..cd6ae31 100644
--- a/cc2/optm.c
+++ b/cc2/optm.c
_AT_@ -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
index 34f35c3..b9847eb 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -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
index 5190ec0..87273a5 100644
--- a/cc2/peep.c
+++ b/cc2/peep.c
_AT_@ -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
index 3c0723c..fa3849c 100644
--- a/cc2/symbol.c
+++ b/cc2/symbol.c
_AT_@ -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
index 3075282..2f93c93 100644
--- a/inc/cc.h
+++ b/inc/cc.h
_AT_@ -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;
Received on Tue Nov 29 2016 - 13:42:25 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 29 2016 - 13:48:15 CET