shithub: scc

Download patch

ref: 64ee117fc51af33bf4557d6405eefc506e269185
parent: 4f388adfd3574c516b7e7c6ef36324d483b0c2d6
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Jan 25 09:22:16 EST 2016

Add TSIZE type

This type is the target specific type for sizes.

--- a/cc1/arch/amd64-sysv/arch.h
+++ b/cc1/arch/amd64-sysv/arch.h
@@ -18,6 +18,7 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
+#define TSIZE       unsigned long
 
 #define L_SCHAR     L_INT8
 #define L_UCHAR     L_UINT8
--- a/cc1/arch/i386-sysv/arch.h
+++ b/cc1/arch/i386-sysv/arch.h
@@ -18,6 +18,7 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
+#define TSIZE       unsigned long
 
 #define L_SCHAR     L_INT8
 #define L_UCHAR     L_UINT8
--- a/cc1/arch/z80/arch.h
+++ b/cc1/arch/z80/arch.h
@@ -18,6 +18,7 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
+#define TSIZE       unsigned short
 
 #define L_SCHAR     L_INT8
 #define L_UCHAR     L_UINT8
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -42,8 +42,8 @@
 	bool arith : 1;             /* this type is INT, ENUM, FLOAT */
 	bool aggreg : 1;            /* this type is struct or union */
 	bool k_r : 1;               /* This is a k&r function */
-	size_t size;                /* sizeof the type */
-	size_t align;               /* align of the type */
+	TSIZE size;                 /* sizeof the type */
+	TSIZE align;                /* align of the type */
 	Type *type;                 /* base type */
 	Symbol *tag;                /* symbol of the strug tag */
 	Type *next;                 /* next element in the hash */
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -166,11 +166,11 @@
 	error("invalid type specification");
 }
 
-static TINT
+static TSIZE
 typesize(Type *tp)
 {
 	Symbol **sp;
-	TINT n, size, align;
+	TSIZE n, size, align;
 
 	switch (tp->op) {
 	case ARY:
--- a/cc2/arch/amd64-sysv/arch.h
+++ b/cc2/arch/amd64-sysv/arch.h
@@ -2,4 +2,5 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
+#define TSIZE   unsigned long
 
--- a/cc2/arch/i386-sysv/arch.h
+++ b/cc2/arch/i386-sysv/arch.h
@@ -2,4 +2,5 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
+#define TSIZE   unsigned long
 
--- a/cc2/arch/z80/arch.h
+++ b/cc2/arch/z80/arch.h
@@ -2,4 +2,4 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
-
+#define TSIZE   unsigned short
\ No newline at end of file
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -107,9 +107,9 @@
 typedef struct symbol Symbol;
 
 struct type {
-	unsigned short size;
-	unsigned short align;
-	unsigned short flags;
+	TSIZE size;
+	TSIZE align;
+	char flags;
 };
 
 struct symbol {