commit 62cbb7d6195369bbe8e2fb95fd47ad44cbf670f8
parent 20c0f4c858c27d197dafb0d8ac810879bb69a6eb
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 17 Jan 2021 10:18:44 -0500
check, gen, emit: tolerate zero declarations
For modules which only define types.
Diffstat:
3 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -1433,6 +1433,4 @@ check(struct context *ctx, const struct ast_unit *aunit, struct unit *unit)
trleave(TR_CHECK, NULL);
scope = scope->next;
}
-
- assert(unit->declarations);
}
diff --git a/src/emit.c b/src/emit.c
@@ -278,7 +278,6 @@ void
emit(struct qbe_program *program, FILE *out)
{
struct qbe_def *def = program->defs;
- assert(def); // At least one
while (def) {
emit_def(def, out);
def = def->next;
diff --git a/src/gen.c b/src/gen.c
@@ -1836,7 +1836,6 @@ gen(const struct unit *unit, struct qbe_program *out)
};
ctx.out->next = &ctx.out->defs;
const struct declarations *decls = unit->declarations;
- assert(decls); // At least one is required
trenter(TR_GEN, "gen");
while (decls) {
gen_decl(&ctx, decls->decl);