scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit d9e75371d9832ae307b06020ea39e0ca8f7bf5ba
parent 416480154b86845ffec424db50b98ee1ff785e0a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 30 Dec 2024 19:59:11 +0100

cc2: Make unlink() global

This function can be very useful in some cases when we
want to reuse a node, but keep it out of the list of
statements.

Diffstat:
Msrc/cmd/scc-cc/cc2/cc2.h | 1+
Msrc/cmd/scc-cc/cc2/node.c | 8++++----
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cmd/scc-cc/cc2/cc2.h b/src/cmd/scc-cc/cc2/cc2.h @@ -268,6 +268,7 @@ extern Node *delstmt(void); extern Node *insstmt(Node *, Node *); extern void delrange(Node *, Node *); extern Node *waftstmt(Node *); +extern Node *unlinkstmt(Node *); /* symbol.c */ #define TMPSYM 0 diff --git a/src/cmd/scc-cc/cc2/node.c b/src/cmd/scc-cc/cc2/node.c @@ -84,8 +84,8 @@ insstmt(Node *np, Node *at) return np; } -static Node * -unlink(Node *np) +Node * +unlinkstmt(Node *np) { Node *next, *prev; @@ -112,7 +112,7 @@ waftstmt(Node *at) if (prev == at) return np; curstmt = prev; - return insstmt(unlink(np), at); + return insstmt(unlinkstmt(np), at); } Node * @@ -128,7 +128,7 @@ delstmt(void) Node *next; next = curstmt->next; - deltree(unlink(curstmt)); + deltree(unlinkstmt(curstmt)); return curstmt = next; }