aboutsummaryrefslogtreecommitdiff
path: root/cc.h
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-11-06 02:46:44 +0100
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-11-06 12:17:01 +0100
commit3e51be9d94e561549281e386ce1b7554018ef4dd (patch)
treea88f20aba911030f16e692351cf5489746917910 /cc.h
parentf66a661359a39e10af01508ad02429517b8460e3 (diff)
cproc: Implement defer statement.defer
implemented by keeping a list of deferred blocks in a function, and emitting them before scope exits (return, lbracket, break, continue) TODO: error checking, the compiler should error should a compile time jump (goto) would go over a defer statement.
Diffstat (limited to 'cc.h')
-rw-r--r--cc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cc.h b/cc.h
index cb53b0d..fabc460 100644
--- a/cc.h
+++ b/cc.h
@@ -26,6 +26,7 @@ enum tokenkind {
TCONSTEXPR,
TCONTINUE,
TDEFAULT,
+ TDEFER,
TDO,
TDOUBLE,
TELSE,
@@ -558,6 +559,9 @@ struct value *mkintconst(unsigned long long);
struct func *mkfunc(struct decl *, char *, struct type *, struct scope *);
void delfunc(struct func *);
struct type *functype(struct func *);
+void funcstartdefer(struct func *);
+void funcenddefer(struct func *);
+void funcdefer(struct func *);
void funclabel(struct func *, struct block *);
struct value *funcexpr(struct func *, struct expr *);
void funcjmp(struct func *, struct block *);