scc

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

commit 4936352376156baa10674dbf8887932189670959
parent ee6d21258db24ac2640a410bc27ea1b552b36ca1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 23 Apr 2014 16:03:24 +0200

Remove the Inst type

This type was only used in a function, so it is better to remove it
and using directly the function pointer declaration.

Diffstat:
Mcc1.h | 5++---
Mcode.c | 2+-
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cc1.h b/cc1.h @@ -206,8 +206,6 @@ typedef struct node { struct node *childs[]; } Node; -typedef void (*Inst)(Node *); /* TODO: remove this typedef */ - enum { OCAST = 1, OPTR, OADD, OARY, OSIZE, OMUL, OSUB, OINC, ODEC, ODIV, OMOD, OSHL, OSHR, @@ -229,7 +227,8 @@ extern void emitprint(Node *); extern Node - *node(Inst code, Type *tp, union unode u, uint8_t nchilds), + *node(void (*code)(Node *), + Type *tp, union unode u, uint8_t nchilds), *unarycode(char op, Type *tp, Node *child), *bincode(char op, Type *tp, Node *np1, Node *np2), *castcode(Node *child, Type *tp), diff --git a/code.c b/code.c @@ -46,7 +46,7 @@ char *opcodes[] = { }; Node * -node(Inst code, Type *tp, union unode u, uint8_t nchilds) +node(void (*code)(Node *), Type *tp, union unode u, uint8_t nchilds) { Node *np = xmalloc(sizeof(*np) + nchilds * sizeof(np));