From 03899710499f3e39c1c9a9780f7e139f553bc060 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 10 Sep 2018 14:54:12 -0400 Subject: [PATCH] No errors compiling on BU linux (CentOS). --- src/core/asm.c | 12 +++++------- src/core/compile.c | 8 ++++---- src/core/io.c | 3 +++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/asm.c b/src/core/asm.c index 0325d90f..8c4fc9ce 100644 --- a/src/core/asm.c +++ b/src/core/asm.c @@ -239,6 +239,9 @@ static int32_t doarg_1( int32_t ret = -1; JanetTable *c; switch (argtype) { + default: + c = NULL; + break; case JANET_OAT_SLOT: c = &a->slots; break; @@ -248,13 +251,6 @@ static int32_t doarg_1( case JANET_OAT_CONSTANT: c = &a->constants; break; - case JANET_OAT_INTEGER: - c = NULL; - break; - case JANET_OAT_TYPE: - case JANET_OAT_SIMPLETYPE: - c = NULL; - break; case JANET_OAT_LABEL: c = &a->labels; break; @@ -516,6 +512,7 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int janet_asm_deinit(&a); longjmp(a.parent->on_error, 1); } + result.funcdef = NULL; result.error = a.errmessage; result.status = JANET_ASSEMBLE_ERROR; janet_asm_deinit(&a); @@ -723,6 +720,7 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int /* Finish everything and return funcdef */ janet_asm_deinit(&a); + result.error = NULL; result.funcdef = def; result.status = JANET_ASSEMBLE_OK; return result; diff --git a/src/core/compile.c b/src/core/compile.c index 6982bc7b..e5b1a5af 100644 --- a/src/core/compile.c +++ b/src/core/compile.c @@ -97,18 +97,18 @@ void janetc_scope(JanetScope *s, JanetCompiler *c, int flags, const char *name) scope.selfconst = -1; scope.bytecode_start = janet_v_count(c->buffer); scope.flags = flags; - *s = scope; + scope.parent = c->scope; /* Inherit slots */ if ((!(flags & JANET_SCOPE_FUNCTION)) && c->scope) { - janetc_regalloc_clone(&s->ra, &(c->scope->ra)); + janetc_regalloc_clone(&scope.ra, &(c->scope->ra)); } else { - janetc_regalloc_init(&s->ra); + janetc_regalloc_init(&scope.ra); } /* Link parent and child and update pointer */ - s->parent = c->scope; if (c->scope) c->scope->child = s; c->scope = s; + *s = scope; } /* Leave a scope. */ diff --git a/src/core/io.c b/src/core/io.c index 28abbb3e..cfe19a8a 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -20,7 +20,10 @@ * IN THE SOFTWARE. */ +/* Compiler feature test macros for things */ #define _DEFAULT_SOURCE +#define _BSD_SOURCE + #include #include #include