scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 262b22d30948622d5a0ddd068cfd49d3ba11c623
parent 3470a3150e2f55bb55b58ab240f6e1a03e620195
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 19 May 2016 08:28:46 +0200

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

Diffstat:
Mcc1/arch/amd64-sysv/arch.h | 1-
Mcc1/arch/i386-sysv/arch.h | 1-
Mcc1/arch/qbe/arch.h | 1-
Mcc1/arch/z80/arch.h | 1-
Mcc1/cc1.h | 4++--
Mcc1/code.c | 6+++---
Mcc1/types.c | 2+-
7 files changed, 6 insertions(+), 10 deletions(-)

diff --git 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 diff --git 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 diff --git 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 diff --git 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 diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -46,8 +46,8 @@ struct type { 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 */ diff --git a/cc1/code.c b/cc1/code.c @@ -263,12 +263,12 @@ emittype(Type *tp) 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); diff --git a/cc1/types.c b/cc1/types.c @@ -171,7 +171,7 @@ typesize(Type *tp) { Symbol **sp; Type *aux; - TSIZE n, size, align, a; + unsigned long n, size, align, a; switch (tp->op) { case ARY: