From 363309a2184bfddba0b7f20ea779a33ce40d92c7 Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 11 Oct 2021 00:06:21 +0300 Subject: [PATCH] some cleanup --- src/core/stuff.c | 4 +++- src/utils/each.h | 4 ++-- src/vm.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/stuff.c b/src/core/stuff.c index 9fd5e0d2..df498e28 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -9,8 +9,10 @@ bool inErr; NORETURN NOINLINE void err(char* s) { if (inErr) { printf("\nCBQN encountered fatal error during information printing of another fatal error. Exiting without printing more info.\n"); + #ifdef DEBUG + __builtin_trap(); + #endif exit(1); - __builtin_abort(); } inErr = true; puts(s); fflush(stdout); diff --git a/src/utils/each.h b/src/utils/each.h index bc2b5761..dc9943b4 100644 --- a/src/utils/each.h +++ b/src/utils/each.h @@ -4,7 +4,7 @@ B eachd_fn(BBB2B f, B fo, B w, B x); // consumes w,x; assumes at least one is array B eachm_fn(BB2B f, B fo, B x); // consumes x; x must be array -static B eachm(B f, B x) { // complete F¨ x without fills +static B eachm(B f, B x) { // complete F¨ x without fills; consumes x if (isAtm(x)) return m_hunit(c1(f, x)); if (isFun(f)) return eachm_fn(c(Fun,f)->c1, f, x); if (isMd(f)) if (isAtm(x) || a(x)->ia) { decR(x); thrM("Calling a modifier"); } @@ -15,7 +15,7 @@ static B eachm(B f, B x) { // complete F¨ x without fills return mut_fcd(r, x); } -static B eachd(B f, B w, B x) { // complete w F¨ x without fills +static B eachd(B f, B w, B x) { // complete w F¨ x without fills; consumes w,x if (isAtm(w) & isAtm(x)) return m_hunit(c2(f, w, x)); return eachd_fn(c2fn(f), f, w, x); } diff --git a/src/vm.c b/src/vm.c index 9ed6f85b..22fd1fb8 100644 --- a/src/vm.c +++ b/src/vm.c @@ -582,7 +582,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume } case FN1C: { P(f)P(x) GS_UPD;POS_UPD; - ADD(c1(f, x); dec(f)); + ADD(c1(f, x)); dec(f); break; } case FN1O: { P(f)P(x) @@ -592,7 +592,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume } case FN2C: { P(w)P(f)P(x) GS_UPD;POS_UPD; - ADD(c2(f, w, x); dec(f)); + ADD(c2(f, w, x)); dec(f); break; } case FN2O: { P(w)P(f)P(x)