strict prototypes

This commit is contained in:
dzaima 2023-02-03 15:27:12 +02:00
parent dbe4c0b51a
commit a84ca6c5d6
31 changed files with 56 additions and 56 deletions

View File

@ -222,7 +222,7 @@ po ← { # parsed options
args isClang
"-Wno-parentheses"
"-Wno-microsoft-anon-tag", "-Wno-bitwise-instead-of-logical", "-Wno-unknown-warning-option"
"-Wno-microsoft-anon-tag", "-Wno-bitwise-instead-of-logical", "-Wno-unknown-warning-option", "-Wstrict-prototypes"
args 0GetLibs@

View File

@ -165,7 +165,7 @@ B ne_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(1); } B r = m_f64(*SH(
static B mathNS;
B getMathNS() {
B getMathNS(void) {
if (mathNS.u == 0) {
#define F(X) inc(bi_##X),
Body* d = m_nnsDesc("sin","cos","tan","asin","acos","atan","atan2","sinh","cosh","tanh","asinh","acosh","atanh","cbrt","log2","log10","log1p","expm1","hypot","fact","logfact","erf","erfc","comb","gcd","lcm","sum");
@ -176,7 +176,7 @@ B getMathNS() {
return inc(mathNS);
}
void arith_init() {
void arith_init(void) {
c(BFn,bi_add)->ident = c(BFn,bi_sub)->ident = c(BFn,bi_or )->ident = c(BFn,bi_ne)->ident = c(BFn,bi_gt)->ident = m_i32(0);
c(BFn,bi_mul)->ident = c(BFn,bi_div)->ident = c(BFn,bi_and)->ident = c(BFn,bi_eq)->ident = c(BFn,bi_ge)->ident = c(BFn,bi_pow)->ident = c(BFn,bi_not)->ident = m_i32(1);
c(BFn,bi_floor)->ident = m_f64(1.0/0.0);

View File

@ -57,7 +57,7 @@ CMP_REC(ne, ne, swapped=0;)
#if SINGELI
#include "../singeli/c/cmp.c"
#else
void cmpA_init() { }
void cmpA_init(void) { }
#define BASE_CMP_LOOP(OP, W, X) \
for (usz j = 0; j < (l+7)>>3; j++) { \
u8 c = 0; \

View File

@ -215,7 +215,7 @@ void setPrevImport(B path, i32 pos) {
bool had; i32 prev = mk_b2i(&prevImports, path, &had);
prevImports->a[prev].val = pos;
}
void clearImportCacheMap() {
void clearImportCacheMap(void) {
if (prevImports!=NULL) free_b2i(prevImports);
prevImports = NULL;
}
@ -248,11 +248,11 @@ B gid2str(i32 n) {
// print_fmt("gid2str %i → %R\n", n, r);
return r;
}
B allNsFields() {
B allNsFields(void) {
return globalNames==NULL? bi_N : incG(globalNameList);
}
void* profiler_makeMap() {
void* profiler_makeMap(void) {
return m_b2i(64);
}
i32 profiler_index(void** mapRaw, B comp) {
@ -273,7 +273,7 @@ B tack_uc1(B t, B o, B x) {
}
void fun_gcFn() {
void fun_gcFn(void) {
if (prevImports!=NULL) mm_visitP(prevImports);
if (globalNames!=NULL) mm_visitP(globalNames);
}
@ -284,7 +284,7 @@ static B funBI_im(B t, B x) { return c(BFn,t)->im(t, x); }
static B funBI_iw(B t, B w, B x) { return c(BFn,t)->iw(t, w, x); }
static B funBI_ix(B t, B w, B x) { return c(BFn,t)->ix(t, w, x); }
static B funBI_identity(B x) { return inc(c(BFn,x)->ident); }
void fns_init() {
void fns_init(void) {
gc_addFn(fun_gcFn);
gc_add_ref(&globalNameList);

View File

@ -325,7 +325,7 @@ B unshare_c1(B t, B x) {
return r;
}
static B internalNS;
B getInternalNS() {
B getInternalNS(void) {
if (internalNS.u == 0) {
#define F(X) v_##X = m_c8vec_0(#X);
FOR_VARIATION(F)

View File

@ -39,7 +39,7 @@ B nativeInvSwap_c1(B t, B x) {
return c1rt(invFnSwap, x);
}
void inverse_init() {
void inverse_init(void) {
fn_invRegDesc = registerNFn(m_c8vec_0("(fn_invReg)"), fn_invReg_c1, fn_invReg_c2);
fn_invSwapDesc = registerNFn(m_c8vec_0("(fn_invSwap)"), fn_invSwap_c1, fn_invSwap_c2);
}

View File

@ -478,7 +478,7 @@ static void print_md1BI(FILE* f, B x) { fprintf(f, "%s", pm1_repr(c(Md1,x)->extr
static B md1BI_im(Md1D* d, B x) { return ((BMd1*)d->m1)->im(d, x); }
static B md1BI_iw(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->iw(d, w, x); }
static B md1BI_ix(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->ix(d, w, x); }
void md1_init() {
void md1_init(void) {
TIi(t_md1BI,print) = print_md1BI;
TIi(t_md1BI,m1_im) = md1BI_im;
TIi(t_md1BI,m1_iw) = md1BI_iw;

View File

@ -42,7 +42,7 @@ typedef struct ReObj {
} ReObj;
void re_visit(Value* v) { mm_visit(((ReObj*)v)->msg); }
void re_freeO(Value* v) { dec(lastErrMsg); lastErrMsg = ((ReObj*)v)->msg; }
void pushRe() {
void pushRe(void) {
ReObj* o = customObj(sizeof(ReObj), re_visit, re_freeO);
o->msg = lastErrMsg;
gsAdd(tag(o,OBJ_TAG));
@ -516,7 +516,7 @@ static void print_md2BI(FILE* f, B x) { fprintf(f, "%s", pm2_repr(c(Md1,x)->extr
static B md2BI_im(Md2D* d, B x) { return ((BMd2*)d->m2)->im(d, x); }
static B md2BI_iw(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->iw(d, w, x); }
static B md2BI_ix(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->ix(d, w, x); }
void md2_init() {
void md2_init(void) {
TIi(t_md2BI,print) = print_md2BI;
TIi(t_md2BI,m2_uc1) = md2BI_uc1;
TIi(t_md2BI,m2_ucw) = md2BI_ucw;

View File

@ -270,7 +270,7 @@ B count_c2(B t, B w, B x) {
}
void search_init() {
void search_init(void) {
{ u64* p; Arr* a=m_bitarrp(&p, 1); arr_shAtm(a); *p= 0; gc_add(enclosed_0=taga(a)); }
{ u64* p; Arr* a=m_bitarrp(&p, 1); arr_shAtm(a); *p=~0ULL; gc_add(enclosed_1=taga(a)); }
}

View File

@ -1503,7 +1503,7 @@ B enclose_uc1(B t, B o, B x) {
return enclose_im(t, c1(o, m_atomUnit(x)));
}
void sfns_init() {
void sfns_init(void) {
c(BFn,bi_pick)->uc1 = pick_uc1;
c(BFn,bi_reverse)->im = reverse_c1;
c(BFn,bi_reverse)->ix = reverse_ix;

View File

@ -989,7 +989,7 @@ B slash_ucw(B t, B o, B w, B x) {
return mut_fcd(r, x);
}
void slash_init() {
void slash_init(void) {
c(BFn,bi_slash)->im = slash_im;
c(BFn,bi_slash)->ucw = slash_ucw;
}

View File

@ -582,7 +582,7 @@ B makeRand_c1(B t, B x) {
return r;
}
static B randNS;
B getRandNS() {
B getRandNS(void) {
if (randNS.u == 0) {
#if RANDSEED==0
randNS = c1(bi_makeRand, m_f64(nsTime()));
@ -742,7 +742,7 @@ B import_c1(B d, B x) {
return r;
}
void clearImportCache() {
void clearImportCache(void) {
if (importKeyList.u!=0) {
dec(importKeyList); importKeyList = m_f64(0);
dec(importValList); importValList = m_f64(0);
@ -1097,7 +1097,7 @@ B tErrRaw_c1(B t, B x) {
}
static B termNS;
B getTermNS() {
B getTermNS(void) {
if (termNS.u == 0) {
#define F(X) incG(bi_##X),
Body* d = m_nnsDesc("flush", "rawmode", "charb", "charn", "outraw", "errraw");
@ -1397,7 +1397,7 @@ DEF_OP2(add) DEF_OP2(sub) DEF_OP2(mul)
#undef DEF_OP2
static B bitNS;
B getBitNS() {
B getBitNS(void) {
if (bitNS.u == 0) {
#define F(X) incG(bi_bit##X),
Body* d = m_nnsDesc("cast","not","neg","and","or","xor","add","sub","mul");
@ -1614,7 +1614,7 @@ u32* dsv_text[] = {
};
B dsv_ns, dsv_vs;
void sysfn_init() {
void sysfn_init(void) {
usz dsv_num = sizeof(dsv_strs)/sizeof(char*);
usz i = 0;
HArr_p dsv_ns0 = m_harrUv(dsv_num); dsv_ns=dsv_ns0.b; gc_add(dsv_ns);
@ -1636,6 +1636,6 @@ void sysfn_init() {
reBQNDesc = registerNFn(m_c8vec_0("(REPL)"), repl_c1, repl_c2);
}
void sysfnPost_init() {
void sysfnPost_init(void) {
c(BMd1,bi_bitcast)->im = bitcast_im;
}

View File

@ -133,7 +133,7 @@ static B md1D_identity(B t) {
return bi_N;
}
void derv_init() {
void derv_init(void) {
TIi(t_md1D,freeO) = md1D_freeO; TIi(t_md1D,freeF) = md1D_freeF; TIi(t_md1D,visit) = md1D_visit; TIi(t_md1D,print) = md1D_print; TIi(t_md1D,decompose) = md1D_decompose;
TIi(t_md2D,freeO) = md2D_freeO; TIi(t_md2D,freeF) = md2D_freeF; TIi(t_md2D,visit) = md2D_visit; TIi(t_md2D,print) = md2D_print; TIi(t_md2D,decompose) = md2D_decompose;
TIi(t_md2H,freeO) = md2H_freeO; TIi(t_md2H,freeF) = md2H_freeF; TIi(t_md2H,visit) = md2H_visit; TIi(t_md2H,print) = md2H_print; TIi(t_md2H,decompose) = md2H_decompose;
@ -147,7 +147,7 @@ void derv_init() {
TIi(t_md1D,fn_ix) = md1D_ix; TIi(t_md2D,fn_ix) = md2D_ix;
TIi(t_md1D,identity) = md1D_identity;
}
void dervPost_init() {
void dervPost_init(void) {
ucwWrapDesc = registerNFn(m_c8vec_0("(temporary function for ⌾)"), ucwWrap_c1, c2_bad);
uc1WrapDesc = registerNFn(m_c8vec_0("(temporary function for ⌾)"), uc1Wrap_c1, c2_bad);
TIi(t_fork,fn_uc1) = fork_uc1; // in post probably to make sure it's not used while not fully initialized or something? idk

View File

@ -64,7 +64,7 @@ static void fillslice_visit(Value* x) { FillSlice* s=(void*)x; mm_visitP(s->p);
static void fillslice_freeO(Value* x) { FillSlice* s=(void*)x; ptr_dec(s->p); dec(s->fill); decSh(x); }
static void fillslice_freeF(Value* x) { fillslice_freeO(x); mm_free(x); }
void fillarr_init() {
void fillarr_init(void) {
TIi(t_fillarr,get) = fillarr_get; TIi(t_fillslice,get) = fillslice_get;
TIi(t_fillarr,getU) = fillarr_getU; TIi(t_fillslice,getU) = fillslice_getU;
TIi(t_fillarr,slice) = fillarr_slice; TIi(t_fillslice,slice) = fillslice_slice;

View File

@ -137,7 +137,7 @@ static void harrP_print(FILE* f, B x) {
}
#endif
void harr_init() {
void harr_init(void) {
TIi(t_harr,get) = harr_get; TIi(t_hslice,get) = hslice_get; TIi(t_harrPartial,get) = harrP_get;
TIi(t_harr,getU) = harr_getU; TIi(t_hslice,getU) = hslice_getU; TIi(t_harrPartial,getU) = harrP_get;
TIi(t_harr,slice) = harr_slice; TIi(t_hslice,slice) = hslice_slice;

View File

@ -78,7 +78,7 @@ static Arr* bitarr_slice(B x, usz s, usz ia) {
static B bitarr_get(Arr* x, usz n) { assert(PTY(x)==t_bitarr); return bitp_get((u64*)((BitArr*)x)->a, n)? m_f64(1) : m_f64(0); }
static bool bitarr_canStore(B x) { return q_bit(x); }
static void bitarr_init() {
static void bitarr_init(void) {
TIi(t_bitarr,get) = bitarr_get;
TIi(t_bitarr,getU) = bitarr_get;
TIi(t_bitarr,slice) = bitarr_slice;
@ -92,7 +92,7 @@ static void bitarr_init() {
TIi(t_bitarr,canStore) = bitarr_canStore;
}
void tyarr_init() {
void tyarr_init(void) {
i8arr_init(); i16arr_init(); i32arr_init(); bitarr_init();
c8arr_init(); c16arr_init(); c32arr_init(); f64arr_init();

View File

@ -914,7 +914,7 @@ void ffiType_print(FILE* f, B x) {
fprintf(f, "");
}
void ffi_init() {
void ffi_init(void) {
boundFnDesc = registerNFn(m_c8vec_0("(foreign function)"), boundFn_c1, boundFn_c2);
foreignFnDesc = registerNFn(m_c8vec_0("(foreign function)"), directFn_c1, directFn_c2);
TIi(t_ffiType,freeO) = ffiType_freeO;
@ -999,7 +999,7 @@ void ffi_init() {
return r;
}
void ffi_init() {
void ffi_init(void) {
HArr_p a = m_harrUv(7);
a.a[0] = m_c8vec_0("chdir");
a.a[1] = m_c8vec_0("fork");

View File

@ -388,7 +388,7 @@ B bqn_fmt(B x); // consumes
B bqn_repr(B x); // consumes
NOINLINE NORETURN void thr(B b);
NOINLINE NORETURN void rethrow();
NOINLINE NORETURN void rethrow(void);
NOINLINE NORETURN void thrM(char* s);
NOINLINE NORETURN void thrF(char* s, ...);
NOINLINE NORETURN void thrOOM(void);

View File

@ -110,7 +110,7 @@ INS B i_FN2Oi(B w, B x, BB2B fm, BBB2B fd, u32* bc) { POS_UPD;
if (q_N(x)) { dec(w); return x; }
else return q_N(w)? fm(b((u64)0), x) : fd(b((u64)0), w, x);
}
INS B i_LST_0() { // TODO combine with ADDI
INS B i_LST_0(void) { // TODO combine with ADDI
return emptyHVec();
}
INS B i_LST_1(B a) {

View File

@ -143,7 +143,7 @@ B load_explain;
#if NATIVE_COMPILER
#include "opt/comp.c"
B load_rtComp;
void switchComp() {
void switchComp(void) {
load_comp = load_comp.u==load_rtComp.u? native_comp : load_rtComp;
}
#endif
@ -301,7 +301,7 @@ void init_comp(B* set, B prim, B sys) {
}
}
}
B getPrimitives() {
B getPrimitives(void) {
B g, r;
if (q_N(comp_currRe)) { g=load_glyphs; r=load_rtObj; }
else { B* o = harr_ptr(comp_currRe); g=o[4]; r=o[3]; }

View File

@ -102,7 +102,7 @@ static bool isCmd(char* s, char** e, const char* cmd) {
static bool cfg_enableKeyboard = true;
static B cfg_path;
NOINLINE void cfg_changed() {
NOINLINE void cfg_changed(void) {
B s = emptyCVec();
AFMT("theme=%i\nkeyboard=%i\n", cfg_theme, cfg_enableKeyboard);
if (CATCH) { freeThrown(); goto end; }
@ -404,7 +404,7 @@ static bool isCmd(char* s, char** e, const char* cmd) {
}
void before_exit() {
void before_exit(void) {
if (global_replxx!=NULL && global_histfile!=NULL) {
replxx_history_save(global_replxx, global_histfile);
replxx_end(global_replxx);
@ -469,7 +469,7 @@ static bool isCmd(char* s, char** e, const char* cmd) {
global_replxx = replxx_init();
}
#else
void before_exit() { }
void before_exit(void) { }
#endif

View File

@ -34,7 +34,7 @@ DEF_FREE(nfnDesc) { err("nfnDesc shouldn't be freed!"); }
void nfnDesc_visit(Value* x) { mm_visit(((NFnDesc*)x)->name); }
void nfnDesc_print(FILE* f, B x) { fprintf(f, "(native function description)"); }
void nfn_init() {
void nfn_init(void) {
nfn_list = emptyHVec();
TIi(t_nfn,freeO) = nfn_freeO; TIi(t_nfnDesc,freeO) = nfnDesc_freeO;
TIi(t_nfn,freeF) = nfn_freeF; TIi(t_nfnDesc,freeF) = nfnDesc_freeF;

View File

@ -224,7 +224,7 @@ static void nsDesc_print(FILE* f, B x) { fprintf(f, "(namespace description)");
void ns_init() {
void ns_init(void) {
TIi(t_ns,freeO) = ns_freeO;
TIi(t_ns,freeF) = ns_freeF;
TIi(t_ns,visit) = ns_visit; TIi(t_nsDesc,visit) = noop_visit;

View File

@ -6,7 +6,7 @@
#define alCap BN(alCap)
#define alSize BN(alSize)
#ifndef MMAP
usz getPageSize();
usz getPageSize(void);
#define MMAP(SZ) mmap(NULL, (SZ)+getPageSize(), PROT_READ|PROT_WRITE, MAP_NORESERVE|MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
#endif

View File

@ -276,7 +276,7 @@ B wm2_ucw(Md2* t, B o, B f, B g, B w, B x) { B t2 = ((WMd2*)t)->v; return TI(t2,
static B m1BI_d(B t, B f ) { return m_md1D(c(Md1,t), f ); }
static B m2BI_d(B t, B f, B g) { return m_md2D(c(Md2,t), f, g); }
void rtWrap_init() {
void rtWrap_init(void) {
TIi(t_funWrap,visit) = wfn_visit; TIi(t_funWrap,identity) = wfn_identity;
TIi(t_md1Wrap,visit) = wm1_visit; TIi(t_md1Wrap,m1_d) = m1BI_d;
TIi(t_md2Wrap,visit) = wm2_visit; TIi(t_md2Wrap,m2_d) = m2BI_d;
@ -288,9 +288,9 @@ void rtWrap_init() {
TIi(t_md2Wrap,m2_ucw) = wm2_ucw;
}
#else
void rtWrap_init() { }
void rtWrap_init(void) { }
#endif
void rtWrap_print() {
void rtWrap_print(void) {
#if RT_PERF
WFun* cf = lastWF;
while (cf) {

View File

@ -18,7 +18,7 @@ FN_LUT_A(cmp_fns, le, AS);
#define ARCH(N) simd_##N
#define DSTE(N) &(cmp_fns_##N[0])
void cmpA_init() {
void cmpA_init(void) {
{
CmpAAFn* srcs[4] = {ARCH(eqAA), ARCH(neAA), ARCH(gtAA), ARCH(geAA)};
CmpAAFn* dsts[4] = {DSTE(eqAA), DSTE(neAA), DSTE(gtAA), DSTE(geAA)};

View File

@ -312,7 +312,7 @@ B mmap_file(B path) {
B mmapH_get(Arr* a, usz pos) { thrM("Reading mmapH directly"); }
void mmap_init() {
void mmap_init(void) {
TIi(t_mmapH,get) = mmapH_get;
TIi(t_mmapH,getU) = mmapH_get;
TIi(t_mmapH,slice) = mmapH_slice;

View File

@ -39,7 +39,7 @@ NOINLINE u64 bqn_hashArr(B x, const u64 secret[4]) { // TODO manual separation o
u64 wy_secret[4];
void hash_init() {
void hash_init(void) {
u64 bad1=0xa0761d6478bd642full; // values wyhash64 is afraid of
u64 bad2=0xe7037ed1a0b428dbull;
again:

View File

@ -402,7 +402,7 @@ M_FillF fillFns[el_MAX];
MutFns mutFns[el_MAX+1];
u8 el_orArr[el_MAX*16 + el_MAX+1];
void mutF_init() {
void mutF_init(void) {
for (u8 i = 0; i <= el_MAX; i++) {
for (u8 j = 0; j <= el_MAX; j++) {
u8 el;

View File

@ -20,7 +20,7 @@
#define NEG_SCIENTIFIC_START 5 // negative scientific representation start
#if NO_RYU
void ryu_init() { }
void ryu_init(void) { }
#else
// original file: d2s.h
@ -635,7 +635,7 @@ bool ryu_s2d_n(u8* buffer, int len, f64* result) {
return true;
}
void ryu_init() {
void ryu_init(void) {
gc_add(fmt_nan = m_c8vec("NaN", 3));
gc_add(fmt_zero[0] = m_c8vec("0", 1));
{ u16* d; B c = m_c16arrv(&d, 1); d[0]=U''; gc_add(c); fmt_inf[0] = c; }

View File

@ -1234,7 +1234,7 @@ B funBl_uc1(B t, B o, B x) {
return funBl_im(t, c1(o, c1(t, x)));
}
void comp_init() {
void comp_init(void) {
TIi(t_comp ,freeO) = comp_freeO; TIi(t_comp ,freeF) = comp_freeF; TIi(t_comp ,visit) = comp_visit; TIi(t_comp ,print) = comp_print;
TIi(t_body ,freeO) = body_freeO; TIi(t_body ,freeF) = body_freeF; TIi(t_body ,visit) = body_visit; TIi(t_body ,print) = body_print;
TIi(t_block ,freeO) = block_freeO; TIi(t_block ,freeF) = block_freeF; TIi(t_block ,visit) = block_visit; TIi(t_block ,print) = block_print;
@ -1459,11 +1459,11 @@ static bool setProfTimer(i64 us) {
return true;
}
void* profiler_makeMap();
void* profiler_makeMap(void);
i32 profiler_index(void** mapRaw, B comp);
void profiler_freeMap(void* mapRaw);
bool profiler_alloc() {
bool profiler_alloc(void) {
profiler_buf_s = profiler_buf_c = mmap(NULL, PROFILE_BUFFER, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (profiler_buf_s == MAP_FAILED) {
fprintf(stderr, "Failed to allocate profiler buffer\n");
@ -1473,7 +1473,7 @@ bool profiler_alloc() {
profile_buf_full = false;
return true;
}
void profiler_free() {
void profiler_free(void) {
munmap(profiler_buf_s, PROFILE_BUFFER);
}
@ -1483,7 +1483,7 @@ bool profiler_start(i64 hz) {
profiler_active = true;
return setProfHandler(true) && setProfTimer(us);
}
bool profiler_stop() {
bool profiler_stop(void) {
if (!profiler_active) return false;
profiler_active = false;
if (profile_buf_full) fprintf(stderr, "Profiler buffer ran out in the middle of execution. Only timings of the start of profiling will be shown.\n");
@ -1533,7 +1533,7 @@ usz profiler_getResults(B* compListRes, B* mapListRes, bool keyPath) {
return compCount;
}
void profiler_displayResults() {
void profiler_displayResults(void) {
printf("Got "N64u" samples\n", (u64)(profiler_buf_c-profiler_buf_s));
B compList, mapList;