strict prototypes

This commit is contained in:
dzaima 2021-07-20 22:21:59 +03:00
parent 7ee8d642dc
commit 5dd7288144
7 changed files with 21 additions and 21 deletions

View File

@ -453,8 +453,8 @@ B exit_c1(B t, B x) {
bqn_exit(q_i32(x)? o2i(x) : 0); bqn_exit(q_i32(x)? o2i(x) : 0);
} }
B getInternalNS(); B getInternalNS(void);
B getMathNS(); B getMathNS(void);
static B file_nsGen; static B file_nsGen;
B sys_c1(B t, B x) { B sys_c1(B t, B x) {

View File

@ -10,7 +10,7 @@
extern B* gStack; // points to after end extern B* gStack; // points to after end
extern B* gStackStart; extern B* gStackStart;
extern B* gStackEnd; extern B* gStackEnd;
void gsPrint(); void gsPrint(void);
static void gsReserve(u64 am) { static void gsReserve(u64 am) {
#ifdef GS_REALLOC #ifdef GS_REALLOC

View File

@ -1,4 +1,4 @@
u64 mm_heapUsed(); u64 mm_heapUsed(void);
#ifdef HEAP_VERIFY #ifdef HEAP_VERIFY
@ -18,6 +18,6 @@ static bool heapVerify_visitP(void* x) {
else if(heapVerify_mode==2) if (x==heap_observed) { printf("referee: %p ", heap_curr); print(tag(heap_curr,OBJ_TAG)); putchar('\n'); } else if(heapVerify_mode==2) if (x==heap_observed) { printf("referee: %p ", heap_curr); print(tag(heap_curr,OBJ_TAG)); putchar('\n'); }
return true; return true;
} }
void heapVerify(); void heapVerify(void);
#endif #endif

View File

@ -6,9 +6,9 @@ static u64 mm_size(Value* x);
static void mm_visit(B x); static void mm_visit(B x);
static void mm_visitP(void* x); static void mm_visitP(void* x);
NORETURN void bqn_exit(i32 code); NORETURN void bqn_exit(i32 code);
u64 mm_heapUsed(); u64 mm_heapUsed(void);
void printAllocStats(); void printAllocStats(void);
void vm_pstLive(); void vm_pstLive(void);
#ifndef MAP_NORESERVE #ifndef MAP_NORESERVE

18
src/h.h
View File

@ -144,7 +144,7 @@ static const u16 VAL_TAG = 0b1111111111110 ; // FFF. 1111111111110............
#define tag(V, T) b(((u64)(V)) | ftag(T)) #define tag(V, T) b(((u64)(V)) | ftag(T))
#define taga(V) tag(V, ARR_TAG) #define taga(V) tag(V, ARR_TAG)
void cbqn_init(); void cbqn_init(void);
typedef union B { typedef union B {
u64 u; u64 u;
@ -215,13 +215,13 @@ typedef struct Arr {
// memory manager // memory manager
typedef void (*V2v)(Value*); typedef void (*V2v)(Value*);
typedef void (*vfn)(); typedef void (*vfn)(void);
void gc_add(B x); // add permanent root object void gc_add(B x); // add permanent root object
void gc_addFn(vfn f); // add function that calls mm_visit/mm_visitP for dynamic roots void gc_addFn(vfn f); // add function that calls mm_visit/mm_visitP for dynamic roots
void gc_maybeGC(); // gc if that seems necessary void gc_maybeGC(void); // gc if that seems necessary
void gc_forceGC(); // force a gc; who knows what happens if gc is disabled (probably should error) void gc_forceGC(void); // force a gc; who knows what happens if gc is disabled (probably should error)
void gc_visitRoots(); void gc_visitRoots(void);
// some primitive actions // some primitive actions
static const B bi_N = b((u64)0x7FF2000000000000ull); // tag(0, TAG_TAG); // make gcc happy static const B bi_N = b((u64)0x7FF2000000000000ull); // tag(0, TAG_TAG); // make gcc happy
@ -260,14 +260,14 @@ B bqn_repr(B x); // consumes
NOINLINE NORETURN void thr(B b); NOINLINE NORETURN void thr(B b);
NOINLINE NORETURN void thrM(char* s); NOINLINE NORETURN void thrM(char* s);
NOINLINE NORETURN void thrF(char* s, ...); NOINLINE NORETURN void thrF(char* s, ...);
NOINLINE NORETURN void thrOOM(); NOINLINE NORETURN void thrOOM(void);
jmp_buf* prepareCatch(); jmp_buf* prepareCatch(void);
#if CATCH_ERRORS #if CATCH_ERRORS
#define CATCH setjmp(*prepareCatch()) // use as `if (CATCH) { /*handle error*/ dec(catchMessage); } /*potentially erroring thing*/ popCatch();` #define CATCH setjmp(*prepareCatch()) // use as `if (CATCH) { /*handle error*/ dec(catchMessage); } /*potentially erroring thing*/ popCatch();`
#else // note: popCatch() must always be called if no error was caught, so no returns before it! #else // note: popCatch() must always be called if no error was caught, so no returns before it!
#define CATCH false #define CATCH false
#endif #endif
void popCatch(); void popCatch(void);
extern B catchMessage; extern B catchMessage;
@ -281,7 +281,7 @@ extern B catchMessage;
#define srnk(X,R) sprnk(v(X),R) #define srnk(X,R) sprnk(v(X),R)
#define VTY(X,T) assert(isVal(X) && v(X)->type==(T)) #define VTY(X,T) assert(isVal(X) && v(X)->type==(T))
void print_vmStack(); void print_vmStack(void);
#ifdef DEBUG #ifdef DEBUG
B validate(B x); B validate(B x);
Value* validateP(Value* x); Value* validateP(Value* x);

View File

@ -333,7 +333,7 @@ B bqn_execFile(B path, B args) { // consumes both
return bqn_exec(file_chars(inc(path)), path, args); return bqn_exec(file_chars(inc(path)), path, args);
} }
void rtWrap_print(); void rtWrap_print(void);
void bqn_exit(i32 code) { void bqn_exit(i32 code) {
rtWrap_print(); rtWrap_print();
CTR_FOR(CTR_PRINT) CTR_FOR(CTR_PRINT)
@ -435,7 +435,7 @@ static inline void base_init() { // very first init function
} }
#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 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(); #define F(X) void X##_init(void);
FOR_INIT(F) FOR_INIT(F)
#undef F #undef F
void cbqn_init() { void cbqn_init() {

View File

@ -168,12 +168,12 @@ static inline void popEnv() {
envCurr--; envCurr--;
} }
void vm_pst(Env* s, Env* e); void vm_pst(Env* s, Env* e);
void vm_pstLive(); void vm_pstLive(void);
void vm_printPos(Comp* comp, i32 bcPos, i64 pos); void vm_printPos(Comp* comp, i32 bcPos, i64 pos);
NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce); // consumes prepend NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce); // consumes prepend
NOINLINE void printErrMsg(B msg); NOINLINE void printErrMsg(B msg);
NOINLINE void unwindEnv(Env* envNew); // envNew==envStart-1 for emptying the env stack NOINLINE void unwindEnv(Env* envNew); // envNew==envStart-1 for emptying the env stack
NOINLINE void unwindCompiler(); // unwind to the env of the invocation of the compiler; UB when not in compiler! NOINLINE void unwindCompiler(void); // unwind to the env of the invocation of the compiler; UB when not in compiler!
typedef struct FldAlias { typedef struct FldAlias {