scc

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

commit 64ee117fc51af33bf4557d6405eefc506e269185
parent 4f388adfd3574c516b7e7c6ef36324d483b0c2d6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 25 Jan 2016 14:22:16 +0100

Add TSIZE type

This type is the target specific type for sizes.

Diffstat:
Mcc1/arch/amd64-sysv/arch.h | 1+
Mcc1/arch/i386-sysv/arch.h | 1+
Mcc1/arch/z80/arch.h | 1+
Mcc1/cc1.h | 4++--
Mcc1/types.c | 4++--
Mcc2/arch/amd64-sysv/arch.h | 1+
Mcc2/arch/i386-sysv/arch.h | 1+
Mcc2/arch/z80/arch.h | 3++-
Mcc2/cc2.h | 6+++---
9 files changed, 14 insertions(+), 8 deletions(-)

diff --git 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 diff --git 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 diff --git 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 diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -42,8 +42,8 @@ struct type { 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 */ diff --git a/cc1/types.c b/cc1/types.c @@ -166,11 +166,11 @@ invalid_type: 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: diff --git 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 diff --git 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 diff --git 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 diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -107,9 +107,9 @@ typedef struct type Type; typedef struct symbol Symbol; struct type { - unsigned short size; - unsigned short align; - unsigned short flags; + TSIZE size; + TSIZE align; + char flags; }; struct symbol {