[hackers] [scc] Remove arch/z80/type.c || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 25 Sep 2015 17:50:44 +0200 (CEST)

commit 8b00f72b25f932c65f7b3f54ca5f94742d0d00be
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Sep 25 17:28:58 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Sep 25 17:28:58 2015 +0200

    Remove arch/z80/type.c
    
    This file was needed in order to have the array types, but this array
    does not depend of the arch because it is parametrized with the definitions
    of arch.h

diff --git a/cc1/Makefile b/cc1/Makefile
index 49a9ded..2548751 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -1,7 +1,7 @@
 include ../config.mk
 
 OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
- code.o stmt.o cpp.o fold.o arch/$(ARCH)/types.o
+ code.o stmt.o cpp.o fold.o
 
 all: cc1
 
diff --git a/cc1/arch/z80/arch.h b/cc1/arch/z80/arch.h
index b52e507..2a144bc 100644
--- a/cc1/arch/z80/arch.h
+++ b/cc1/arch/z80/arch.h
_AT_@ -1,7 +1,37 @@
 
-#define TINT long long
-#define TUINT unsigned long long
-#define TFLOAT double
+#define TINT long long
+#define TUINT unsigned long long
+#define TFLOAT double
 
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 2
+#define RANK_CHAR 3
+#define RANK_SHORT 4
+#define RANK_USHORT 5
+#define RANK_INT 6
+#define RANK_UINT 7
+#define RANK_LONG 8
+#define RANK_ULONG 9
+#define RANK_LLONG 10
+#define RANK_ULLONG 11
+#define RANK_FLOAT 12
+#define RANK_DOUBLE 13
+#define RANK_LDOUBLE 15
+
+#define L_SCHAR L_INT8
+#define L_UCHAR L_UINT8
+#define L_CHAR L_UINT8
+#define L_SHORT L_INT16
+#define L_USHORT L_UINT16
 #define L_INT L_INT16
-#define L_ENUM L_INT
\ No newline at end of file
+#define L_UINT L_UINT16
+#define L_LONG L_INT32
+#define L_ULONG L_UINT32
+#define L_LLONG L_INT64
+#define L_ULLONG L_UINT64
+#define L_BOOL 'B'
+#define L_FLOAT 'J'
+#define L_DOUBLE 'D'
+#define L_LDOUBLE 'H'
+#define L_ENUM L_INT
diff --git a/cc1/arch/z80/types.c b/cc1/arch/z80/types.c
deleted file mode 100644
index 3d08060..0000000
--- a/cc1/arch/z80/types.c
+++ /dev/null
_AT_@ -1,223 +0,0 @@
-
-#include <stdio.h>
-
-#include "../../../inc/cc.h"
-#include "../../cc1.h"
-#include "arch.h"
-
-#define RANK_BOOL 0
-#define RANK_SCHAR 1
-#define RANK_UCHAR 2
-#define RANK_CHAR 3
-#define RANK_SHORT 4
-#define RANK_USHORT 5
-#define RANK_INT 6
-#define RANK_UINT 7
-#define RANK_LONG 8
-#define RANK_ULONG 9
-#define RANK_LLONG 10
-#define RANK_ULLONG 11
-#define RANK_FLOAT 12
-#define RANK_DOUBLE 13
-#define RANK_LDOUBLE 15
-
-#define L_SCHAR L_INT8
-#define L_UCHAR L_UINT8
-#define L_CHAR L_UINT8
-#define L_SHORT L_INT16
-#define L_USHORT L_UINT16
-#define L_UINT L_UINT16
-#define L_LONG L_INT32
-#define L_ULONG L_UINT32
-#define L_LLONG L_INT64
-#define L_ULLONG L_UINT64
-#define L_BOOL 'B'
-#define L_FLOAT 'J'
-#define L_DOUBLE 'D'
-#define L_LDOUBLE 'H'
-
-/*
- * Initializaion of type pointers were done with
- * a C99 initilizator '... = &(Type) {...', but
- * c compiler in Plan9 gives error with this
- * syntax, so I have switched it to this ugly form
- * I hope I will change it again in the future
- */
-static Type types[] = {
- { /* 0 = voidtype */
- .op = VOID,
- .letter = L_VOID,
- .printed = 1
- },
- { /* 1 = pvoidtype */
- .op = PTR,
- .letter = L_POINTER,
- .size = 2,
- .align = 2,
- .printed = 1
- },
- { /* 2 = booltype */
- .op = INT,
- .letter = L_BOOL,
- .defined = 1,
- .size = 1,
- .align = 1,
- .n.rank = RANK_BOOL,
- .printed = 1
- },
- { /* 3 = schartype */
- .op = INT,
- .letter = L_SCHAR,
- .defined = 1,
- .size = 1,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_SCHAR,
- .printed = 1
- },
- { /* 4 = uchartype */
- .op = INT,
- .letter = L_UCHAR,
- .defined = 1,
- .size = 1,
- .align = 1,
- .n.rank = RANK_UCHAR,
- .printed = 1
- },
- { /* 5 = chartype */
- .op = INT,
- .letter = L_CHAR,
- .defined = 1,
- .size = 1,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_CHAR,
- .printed = 1
- },
- { /* 6 = ushortype */
- .op = INT,
- .letter = L_USHORT,
- .defined = 1,
- .size = 2,
- .align = 1,
- .n.rank = RANK_USHORT,
- .printed = 1
- },
- { /* 7 = shortype */
- .op = INT,
- .letter = L_SHORT,
- .defined = 1,
- .size = 2,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_SHORT,
- .printed = 1
- },
- { /* 8 = uinttype */
- .op = INT,
- .letter = L_UINT,
- .defined = 1,
- .size = 2,
- .align = 1,
- .n.rank = RANK_UINT,
- .printed = 1
- },
- { /* 9 = inttype */
- .op = INT,
- .letter = L_INT,
- .defined = 1,
- .size = 2,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_INT,
- .printed = 1
- },
- { /* 10 = longtype */
- .op = INT,
- .letter = L_LONG,
- .defined = 1,
- .size = 4,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_LONG,
- .printed = 1
- },
- { /* 11 = ulongtype */
- .op = INT,
- .letter = L_ULONG,
- .defined = 1,
- .size = 4,
- .align = 1,
- .n.rank = RANK_ULONG,
- .printed = 1
- },
- { /* 12 = ullongtype */
- .op = INT,
- .letter = L_ULLONG,
- .defined = 1,
- .size = 8,
- .align = 1,
- .n.rank = RANK_ULLONG,
- .printed = 1
- },
- { /* 13 = llongtype */
- .op = INT,
- .letter = L_LLONG,
- .defined = 1,
- .size = 8,
- .align = 1,
- .sign = 1,
- .n.rank = RANK_LLONG,
- .printed = 1
- },
- { /* 14 = floattype */
- .op = FLOAT,
- .letter = L_FLOAT,
- .defined = 1,
- .size = 4,
- .align = 1,
- .n.rank = RANK_FLOAT,
- .printed = 1
- },
- { /* 15 = doubletype */
- .op = FLOAT,
- .letter = L_DOUBLE,
- .defined = 1,
- .size = 8,
- .align = 1,
- .n.rank = RANK_DOUBLE,
- .printed = 1
- },
- { /* 16 = ldoubletype */
- .op = FLOAT,
- .letter = L_LDOUBLE,
- .defined = 1,
- .size = 16,
- .align = 1,
- .n.rank = RANK_LDOUBLE,
- .printed = 1
- },
- { /* 17 = sizettype */
- .op = INT,
- .letter = L_UINT,
- .defined = 1,
- .size = 2,
- .align = 1,
- .n.rank = RANK_UINT,
- .printed = 1
- }
-};
-
-Type *voidtype = &types[0], *pvoidtype = &types[1],
- *booltype = &types[2], *schartype = &types[3],
- *uchartype = &types[4], *chartype = &types[5],
- *ushortype = &types[6], *shortype = &types[7],
- *uinttype = &types[8], *inttype = &types[9],
- *longtype = &types[10], *ulongtype = &types[11],
- *ullongtype = &types[12], *llongtype = &types[13],
- *floattype = &types[14], *doubletype = &types[15],
- *ldoubletype = &types[16], *sizettype = &types[17];
-
-static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
- dummy1 = {.u.i = 1, .type = &types[9]};
-Symbol *zero = &dummy0, *one = &dummy1;
diff --git a/cc1/types.c b/cc1/types.c
index 47ac04d..bd48805 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -16,7 +16,7 @@
  * TUINT and TFLOAT are smaller than any of the constants in this
  * array. Ignore them if you know that the target types are correct
  */
-struct limits limits[][4] = {
+static struct limits limits[][4] = {
         {
                 { /* 0 = unsigned 1 byte */
                         .min.u = 0,
_AT_@ -72,6 +72,192 @@ struct limits limits[][4] = {
         }
 };
 
+/*
+ * Initializaion of type pointers were done with
+ * a C99 initilizator '... = &(Type) {...', but
+ * c compiler in Plan9 gives error with this
+ * syntax, so I have switched it to this ugly form
+ * I hope I will change it again in the future
+ */
+static Type types[] = {
+ { /* 0 = voidtype */
+ .op = VOID,
+ .letter = L_VOID,
+ .printed = 1
+ },
+ { /* 1 = pvoidtype */
+ .op = PTR,
+ .letter = L_POINTER,
+ .size = 2,
+ .align = 2,
+ .printed = 1
+ },
+ { /* 2 = booltype */
+ .op = INT,
+ .letter = L_BOOL,
+ .defined = 1,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_BOOL,
+ .printed = 1
+ },
+ { /* 3 = schartype */
+ .op = INT,
+ .letter = L_SCHAR,
+ .defined = 1,
+ .size = 1,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_SCHAR,
+ .printed = 1
+ },
+ { /* 4 = uchartype */
+ .op = INT,
+ .letter = L_UCHAR,
+ .defined = 1,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_UCHAR,
+ .printed = 1
+ },
+ { /* 5 = chartype */
+ .op = INT,
+ .letter = L_CHAR,
+ .defined = 1,
+ .size = 1,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_CHAR,
+ .printed = 1
+ },
+ { /* 6 = ushortype */
+ .op = INT,
+ .letter = L_USHORT,
+ .defined = 1,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_USHORT,
+ .printed = 1
+ },
+ { /* 7 = shortype */
+ .op = INT,
+ .letter = L_SHORT,
+ .defined = 1,
+ .size = 2,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_SHORT,
+ .printed = 1
+ },
+ { /* 8 = uinttype */
+ .op = INT,
+ .letter = L_UINT,
+ .defined = 1,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_UINT,
+ .printed = 1
+ },
+ { /* 9 = inttype */
+ .op = INT,
+ .letter = L_INT,
+ .defined = 1,
+ .size = 2,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_INT,
+ .printed = 1
+ },
+ { /* 10 = longtype */
+ .op = INT,
+ .letter = L_LONG,
+ .defined = 1,
+ .size = 4,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_LONG,
+ .printed = 1
+ },
+ { /* 11 = ulongtype */
+ .op = INT,
+ .letter = L_ULONG,
+ .defined = 1,
+ .size = 4,
+ .align = 1,
+ .n.rank = RANK_ULONG,
+ .printed = 1
+ },
+ { /* 12 = ullongtype */
+ .op = INT,
+ .letter = L_ULLONG,
+ .defined = 1,
+ .size = 8,
+ .align = 1,
+ .n.rank = RANK_ULLONG,
+ .printed = 1
+ },
+ { /* 13 = llongtype */
+ .op = INT,
+ .letter = L_LLONG,
+ .defined = 1,
+ .size = 8,
+ .align = 1,
+ .sign = 1,
+ .n.rank = RANK_LLONG,
+ .printed = 1
+ },
+ { /* 14 = floattype */
+ .op = FLOAT,
+ .letter = L_FLOAT,
+ .defined = 1,
+ .size = 4,
+ .align = 1,
+ .n.rank = RANK_FLOAT,
+ .printed = 1
+ },
+ { /* 15 = doubletype */
+ .op = FLOAT,
+ .letter = L_DOUBLE,
+ .defined = 1,
+ .size = 8,
+ .align = 1,
+ .n.rank = RANK_DOUBLE,
+ .printed = 1
+ },
+ { /* 16 = ldoubletype */
+ .op = FLOAT,
+ .letter = L_LDOUBLE,
+ .defined = 1,
+ .size = 16,
+ .align = 1,
+ .n.rank = RANK_LDOUBLE,
+ .printed = 1
+ },
+ { /* 17 = sizettype */
+ .op = INT,
+ .letter = L_UINT,
+ .defined = 1,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_UINT,
+ .printed = 1
+ }
+};
+
+Type *voidtype = &types[0], *pvoidtype = &types[1],
+ *booltype = &types[2], *schartype = &types[3],
+ *uchartype = &types[4], *chartype = &types[5],
+ *ushortype = &types[6], *shortype = &types[7],
+ *uinttype = &types[8], *inttype = &types[9],
+ *longtype = &types[10], *ulongtype = &types[11],
+ *ullongtype = &types[12], *llongtype = &types[13],
+ *floattype = &types[14], *doubletype = &types[15],
+ *ldoubletype = &types[16], *sizettype = &types[17];
+
+static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
+ dummy1 = {.u.i = 1, .type = &types[9]};
+Symbol *zero = &dummy0, *one = &dummy1;
+
 struct limits *
 getlimits(Type *tp)
 {
Received on Fri Sep 25 2015 - 17:50:44 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 25 2015 - 18:00:19 CEST