ref: 4936352376156baa10674dbf8887932189670959
parent: ee6d21258db24ac2640a410bc27ea1b552b36ca1
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Apr 23 12:03:24 EDT 2014
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.
--- a/cc1.h
+++ b/cc1.h
@@ -206,8 +206,6 @@
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 @@
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),
--- a/code.c
+++ b/code.c
@@ -46,7 +46,7 @@
};
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));