From e04cd3c135cab3c99769700102837b6db57f3d7f Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 22 Jul 2021 03:38:25 +0300 Subject: [PATCH] make gcc warn less --- src/load.c | 13 +++++++------ src/vm.c | 9 ++++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/load.c b/src/load.c index 44dff045..ac0123f9 100644 --- a/src/load.c +++ b/src/load.c @@ -5,6 +5,11 @@ #include "utils/file.h" #include "utils/builtins.h" +#define FOR_INIT(F) F(harr) F(fillarr) F(i32arr) F(c32arr) F(f64arr) F(hash) F(sfns) F(fns) F(arith) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(load) F(sysfnPost) +#define F(X) void X##_init(void); +FOR_INIT(F) +#undef F + u64 mm_heapMax = HEAP_MAX; u64 mm_heapAlloc; @@ -181,7 +186,7 @@ void bqn_setComp(B comp) { // consumes; doesn't unload old comp, but whatever gc_add(load_comp); } -static inline void load_init() { // very last init function +void load_init() { // very last init function comp_currPath = bi_N; comp_currArgs = bi_N; comp_currSrc = bi_N; @@ -374,7 +379,7 @@ static B empty_getU(B x, usz n) { } #endif -static inline void base_init() { // very first init function +void base_init() { // very first init function for (u64 i = 0; i < t_COUNT; i++) { TIi(i,free) = def_free; TIi(i,visit) = def_visit; @@ -434,10 +439,6 @@ static inline void base_init() { // very first init function #undef FD } -#define FOR_INIT(F) F(base) F(harr) F(fillarr) F(i32arr) F(c32arr) F(f64arr) F(hash) F(sfns) F(fns) F(arith) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(load) F(sysfnPost) -#define F(X) void X##_init(void); -FOR_INIT(F) -#undef F void cbqn_init() { #define F(X) X##_init(); FOR_INIT(F) diff --git a/src/vm.c b/src/vm.c index b56f35f3..387dd78d 100644 --- a/src/vm.c +++ b/src/vm.c @@ -119,8 +119,9 @@ void gsPrint() { while (c!=gStack) { printf(" %d: ", i); fflush(stdout); print(*c); fflush(stdout); - if (isVal(*c)) printf(", refc=%d", v(*c)->refc); fflush(stdout); + if (isVal(*c)) printf(", refc=%d", v(*c)->refc); printf("\n"); + fflush(stdout); c++; i++; } @@ -163,8 +164,10 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl bodyAm2 = a(b2)->ia; BS2B b2GetU = TI(b2,getU); bodyILen = bodyAm1+bodyAm2; TALLOC(i32, bodyInds_, bodyILen+2); bodyI = bodyInds_; - for (i32 i = 0; i < bodyAm1; i++) bodyI[i ] = o2i(b1GetU(b1, i)); for (i32 i = 1; i < bodyAm1; i++) if (bodyI[i]>bodyI[i-1]) thrM("VM compiler: Expecte body indices to be sorted"); - for (i32 i = 0; i < bodyAm2; i++) bodyI[i+bodyAm1+1] = o2i(b2GetU(b2, i)); for (i32 i = 1; i < bodyAm2; i++) if (bodyI[i]>bodyI[i-1]) thrM("VM compiler: Expecte body indices to be sorted"); + for (i32 i = 0; i < bodyAm1; i++) bodyI[i ] = o2i(b1GetU(b1, i)); + for (i32 i = 0; i < bodyAm2; i++) bodyI[i+bodyAm1+1] = o2i(b2GetU(b2, i)); + for (i32 i = 1; i < bodyAm1; i++) if (bodyI[i]>bodyI[i-1]) thrM("VM compiler: Expecte body indices to be sorted"); + for (i32 i = 1; i < bodyAm2; i++) if (bodyI[i]>bodyI[i-1]) thrM("VM compiler: Expecte body indices to be sorted"); bodyI[bodyAm1] = bodyI[bodyILen+1] = I32_MAX; } else { bodyILen = 2;