summaryrefslogtreecommitdiff
path: root/sdecls_cgen.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-02-26 21:00:51 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-02-26 21:00:51 -0500
commitbfee5c00eed983ccf74810a366112e106226ace2 (patch)
treef9941c29f70c5012d9e84f21d8098ebc10f502ef /sdecls_cgen.c
parent03b405750adff0e156f344fd4ab02dd5c6bc4da0 (diff)
cgen no longer produces errors!
Diffstat (limited to 'sdecls_cgen.c')
-rw-r--r--sdecls_cgen.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/sdecls_cgen.c b/sdecls_cgen.c
index 6900b78..eb388c3 100644
--- a/sdecls_cgen.c
+++ b/sdecls_cgen.c
@@ -4,14 +4,13 @@
You should have received a copy of the GNU General Public License along with toc. If not, see <https://www.gnu.org/licenses/>.
*/
static void cgen_sdecls_stmt(CGenerator *g, Statement *s);
-static bool cgen_sdecls_decl(CGenerator *g, Declaration *d);
-static bool cgen_sdecls_expr(CGenerator *g, Expression *e);
+static void cgen_sdecls_decl(CGenerator *g, Declaration *d);
+static void cgen_sdecls_expr(CGenerator *g, Expression *e);
/* i is the name for this type, NULL if not available */
-/* ALWAYS RETURNS TRUE. it just returns a bool for cgen_recurse_into_type to work */
-static bool cgen_sdecls_type(CGenerator *g, Type *type) {
+static void cgen_sdecls_type(CGenerator *g, Type *type) {
if (!(type->flags & TYPE_IS_RESOLVED)) /* non-instance constant fn parameter type */
- return true;
+ return;
if (type->kind == TYPE_STRUCT) {
StructDef *sdef = type->struc;
/* we'll actually define the struct later; here we can just declare it */
@@ -30,11 +29,9 @@ static bool cgen_sdecls_type(CGenerator *g, Type *type) {
}
}
cgen_recurse_subtypes(cgen_sdecls_type, g, type);
- return true;
}
-/* ALWAYS RETURNS TRUE. just returns a bool for cgen_recurse_subexprs to work. */
-static bool cgen_sdecls_block(CGenerator *g, Block *b) {
+static void cgen_sdecls_block(CGenerator *g, Block *b) {
Block *prev_block = g->block;
g->block = b;
@@ -43,11 +40,9 @@ static bool cgen_sdecls_block(CGenerator *g, Block *b) {
if (b->ret_expr)
cgen_sdecls_expr(g, b->ret_expr);
g->block = prev_block;
- return true;
}
-/* ALWAYS RETURNS TRUE. just returns a bool for cgen_recurse_subexprs to work. */
-static bool cgen_sdecls_expr(CGenerator *g, Expression *e) {
+static void cgen_sdecls_expr(CGenerator *g, Expression *e) {
switch (e->kind) {
case EXPR_CAST:
cgen_sdecls_type(g, &e->cast.type);
@@ -65,15 +60,13 @@ static bool cgen_sdecls_expr(CGenerator *g, Expression *e) {
default: break;
}
cgen_recurse_subexprs(g, e, cgen_sdecls_expr, cgen_sdecls_block, cgen_sdecls_decl);
- return true;
}
-/* ALWAYS RETURNS TRUE. just returns a bool for cgen_recurse_subexprs to work. */
-static bool cgen_sdecls_decl(CGenerator *g, Declaration *d) {
+static void cgen_sdecls_decl(CGenerator *g, Declaration *d) {
if (d->flags & DECL_FOREIGN) {
/* handled by cgen_decls */
- return true;
+ return;
}
cgen_sdecls_type(g, &d->type);
if (cgen_fn_is_direct(g, d)) {
@@ -93,7 +86,6 @@ static bool cgen_sdecls_decl(CGenerator *g, Declaration *d) {
d->expr.fn->flags |= FN_EXPR_EXPORT;
}
}
- return true;
}
static void cgen_sdecls_stmt(CGenerator *g, Statement *s) {