shithub: scc

Download patch

ref: 65fbd5ccb729bd1f8b8e4ffe2951923434bc76f9
parent: 5213d2286aaf69d7c9eaf8010526ad18180cb8ff
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu May 19 04:28:46 EDT 2016

[cc1] Remove TSIZE type

This type was used like a host dependant type which represents
the size quantities, but it generated some problems, mainly
in the printf strings and in the range comparisions (in the
first because we didn't know the correct format specifier and
in the second because we didn't know the maximum/minimun values
of the type). This modification is a step to make cc1 independent
of the host architecture.

--- a/cc1/arch/amd64-sysv/arch.h
+++ b/cc1/arch/amd64-sysv/arch.h
@@ -18,6 +18,5 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
-#define TSIZE       unsigned long
 
 #define L_ENUM      L_INT32
--- a/cc1/arch/i386-sysv/arch.h
+++ b/cc1/arch/i386-sysv/arch.h
@@ -18,6 +18,5 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
-#define TSIZE       unsigned long
 
 #define L_ENUM      L_INT32
--- a/cc1/arch/qbe/arch.h
+++ b/cc1/arch/qbe/arch.h
@@ -18,6 +18,5 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
-#define TSIZE       unsigned long
 
 #define L_ENUM      L_INT32
--- a/cc1/arch/z80/arch.h
+++ b/cc1/arch/z80/arch.h
@@ -18,6 +18,5 @@
 #define TINT        long long
 #define TUINT       unsigned long long
 #define TFLOAT      double
-#define TSIZE       unsigned short
 
 #define L_ENUM      L_INT16
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -46,8 +46,8 @@
 	short id;                   /* type id, used in dcls */
 	char letter;                /* letter of the type */
 	unsigned char prop;         /* type properties */
-	TSIZE size;                 /* sizeof the type */
-	TSIZE align;                /* align of the type */
+	unsigned long size;         /* sizeof the type */
+	unsigned long 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/code.c
+++ b/cc1/code.c
@@ -263,12 +263,12 @@
 			emittype((*sp)->type);
 		emitletter(tp);
 		tag = tp->tag->name;
-		printf("\t\"%s\t#%c%llX\t#%c%llX\n",
+		printf("\t\"%s\t#%c%lX\t#%c%lX\n",
 		       (tag) ? tag : "",
 		       sizettype->letter,
-		       (unsigned long long) tp->size,
+		       tp->size,
 		       sizettype->letter,
-		       (unsigned long long) tp->align);
+		       tp->align);
 		n = tp->n.elem;
 		for (sp = tp->p.fields; n-- > 0; ++sp)
 			emit(ODECL, *sp);
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -171,7 +171,7 @@
 {
 	Symbol **sp;
 	Type *aux;
-	TSIZE n, size, align, a;
+	unsigned long n, size, align, a;
 
 	switch (tp->op) {
 	case ARY: