harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 374ac9b95c7ed09b9652469d4cd3b8e848ffc941
parent 2e57947c398da8594ef65becb074aa62854ed6e5
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 22 Jan 2021 11:15:29 -0500

mod: handle missing modules

Diffstat:
Msrc/mod.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mod.c b/src/mod.c @@ -1,4 +1,5 @@ #include <assert.h> +#include <errno.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -50,6 +51,13 @@ module_resolve(struct identifier *ident, struct type_store *store) const char *path = open_typedefs(ident); FILE *f = fopen(path, "r"); + if (!f) { + fprintf(stderr, "Could not open module '%s' for reading: %s\n", + identifier_unparse(ident), + strerror(errno)); + exit(1); + } + lex_init(&lexer, f, path); parse(&lexer, &aunit.subunits); lex_finish(&lexer);