don't need to mark static globals as hidden

gcc complains about this
This commit is contained in:
dzaima 2024-02-01 21:22:42 +02:00
parent c078f62b1f
commit 1b26e85325
19 changed files with 83 additions and 82 deletions

View File

@ -163,7 +163,7 @@ B eq_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(0); } B r = m_i32(RNK(
B ne_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(1); } B r = m_f64(*SH(x)); decG(x); return r; }
static GLOBAL B mathNS;
STATIC_GLOBAL B mathNS;
B getMathNS(void) {
if (mathNS.u == 0) {
#define F(X) incG(bi_##X),

View File

@ -303,7 +303,7 @@ B find_c2(B t, B w, B x) {
decG(x); decG(w); return r;
}
static GLOBAL H_b2i* globalNames;
STATIC_GLOBAL H_b2i* globalNames;
GLOBAL B globalNameList;
i32 str2gid(B s) {
if (globalNames==NULL) {

View File

@ -79,10 +79,10 @@ B info_c1(B t, B x) {
F(Af) F(Sf) F(AfInc) F(SfInc) \
F(Ab) F(AbInc)
#define F(X) static GLOBAL B v_##X;
#define F(X) STATIC_GLOBAL B v_##X;
FOR_VARIATION(F)
#undef F
static GLOBAL B listVariations_def;
STATIC_GLOBAL B listVariations_def;
B listVariations_c2(B t, B w, B x) {
if (!isArr(x)) thrM("•internal.ListVariations: 𝕩 must be an array");
@ -162,7 +162,7 @@ static bool u8_get(u8** cv, u8* cE, const char* x) {
}
static GLOBAL B variation_refs;
STATIC_GLOBAL B variation_refs;
B variation_c2(B t, B w, B x) {
if (!isArr(w)) thrM("•internal.Variation: Non-array 𝕨");
if (!isArr(x)) thrM("•internal.Variation: Non-array 𝕩");
@ -380,7 +380,7 @@ B unshare_c1(B t, B x) {
dec(x);
return r;
}
static GLOBAL B internalNS;
STATIC_GLOBAL B internalNS;
B getInternalNS(void) {
if (internalNS.u == 0) {
#define F(X) v_##X = m_c8vec_0(#X);

View File

@ -3,8 +3,8 @@
#include "../nfns.h"
static GLOBAL NFnDesc* fn_invRegDesc;
static GLOBAL NFnDesc* fn_invSwapDesc;
STATIC_GLOBAL NFnDesc* fn_invRegDesc;
STATIC_GLOBAL NFnDesc* fn_invSwapDesc;
B fn_invReg_c1 (B t, B x) { B f = nfn_objU(t); return TI(f, fn_im)(f, x); }
B fn_invReg_c2 (B t, B w, B x) { B f = nfn_objU(t); return TI(f, fn_ix)(f, w, x); }
B fn_invSwap_c1(B t, B x) { B f = nfn_objU(t); return TI(f, fn_is)(f, x); }

View File

@ -323,10 +323,10 @@ B hash_c1(B t, B x) {
static GLOBAL Body* rand_ns;
static GLOBAL B rand_rangeName; static GLOBAL NFnDesc* rand_rangeDesc;
static GLOBAL B rand_dealName; static GLOBAL NFnDesc* rand_dealDesc;
static GLOBAL B rand_subsetName; static GLOBAL NFnDesc* rand_subsetDesc;
STATIC_GLOBAL Body* rand_ns;
STATIC_GLOBAL B rand_rangeName; STATIC_GLOBAL NFnDesc* rand_rangeDesc;
STATIC_GLOBAL B rand_dealName; STATIC_GLOBAL NFnDesc* rand_dealDesc;
STATIC_GLOBAL B rand_subsetName; STATIC_GLOBAL NFnDesc* rand_subsetDesc;
#define RAND_START Scope* sc = c(NS,nfn_objU(t))->sc; \
u64 seed = sc->vars[0].u | sc->vars[1].u<<32;
#define RAND_END sc->vars[0].u = seed>>32; \
@ -649,7 +649,7 @@ B makeRand_c1(B t, B x) {
for (i32 i = 2; i < 5; i++) nfn_swapObj(sc->vars[i], incG(r));
return r;
}
static GLOBAL B randNS;
STATIC_GLOBAL B randNS;
B getRandNS(void) {
if (randNS.u == 0) {
#if RANDSEED==0
@ -661,9 +661,9 @@ B getRandNS(void) {
}
return incG(randNS);
}
static GLOBAL NFnDesc* bqnDesc;
static GLOBAL NFnDesc* rebqnDesc;
static GLOBAL NFnDesc* rebqnResDesc;
STATIC_GLOBAL NFnDesc* bqnDesc;
STATIC_GLOBAL NFnDesc* rebqnDesc;
STATIC_GLOBAL NFnDesc* rebqnResDesc;
B rebqn_c1(B t, B x) {
if (!isNsp(x)) thrM("•ReBQN: Argument must be a namespace");
B repl = ns_getC(x, "repl");
@ -707,14 +707,14 @@ B currentError_c1(B t, B x) {
B currentError_c1(B t, B x) { thrM("•CurrentError: No errors as error catching has been disabled"); }
#endif
static GLOBAL Body* hashmap_ns;
static GLOBAL NFnDesc* hashmap_getDesc;
static GLOBAL NFnDesc* hashmap_hasDesc;
static GLOBAL NFnDesc* hashmap_setDesc;
static GLOBAL NFnDesc* hashmap_deleteDesc;
static GLOBAL NFnDesc* hashmap_countDesc;
static GLOBAL NFnDesc* hashmap_keysDesc;
static GLOBAL NFnDesc* hashmap_valuesDesc;
STATIC_GLOBAL Body* hashmap_ns;
STATIC_GLOBAL NFnDesc* hashmap_getDesc;
STATIC_GLOBAL NFnDesc* hashmap_hasDesc;
STATIC_GLOBAL NFnDesc* hashmap_setDesc;
STATIC_GLOBAL NFnDesc* hashmap_deleteDesc;
STATIC_GLOBAL NFnDesc* hashmap_countDesc;
STATIC_GLOBAL NFnDesc* hashmap_keysDesc;
STATIC_GLOBAL NFnDesc* hashmap_valuesDesc;
// Hash object handling defined in search.c
extern B hashmap_build(B keys, usz n);
extern B hashmap_lookup(B* vars, B w, B x);
@ -761,7 +761,7 @@ B hashMap_c2(B t, B w, B x) {
return ns;
}
static GLOBAL NFnDesc* fileAtDesc;
STATIC_GLOBAL NFnDesc* fileAtDesc;
B fileAt_c1(B d, B x) {
return path_rel(nfn_objU(d), x, "•file.At");
}
@ -771,7 +771,7 @@ B fileAt_c2(B d, B w, B x) {
dec(w);
return r;
}
static GLOBAL NFnDesc* fCharsDesc;
STATIC_GLOBAL NFnDesc* fCharsDesc;
B fchars_c1(B d, B x) {
return path_chars(path_rel(nfn_objU(d), x, "•file.Chars"));
}
@ -782,7 +782,7 @@ B fchars_c2(B d, B w, B x) {
dec(x);
return p;
}
static GLOBAL NFnDesc* fBytesDesc;
STATIC_GLOBAL NFnDesc* fBytesDesc;
B fbytes_c1(B d, B x) {
I8Arr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes"));
usz ia = PIA(tf);
@ -798,7 +798,7 @@ B fbytes_c2(B d, B w, B x) {
dec(x);
return p;
}
static GLOBAL NFnDesc* fLinesDesc;
STATIC_GLOBAL NFnDesc* fLinesDesc;
B flines_c1(B d, B x) {
return path_lines(path_rel(nfn_objU(d), x, "•file.Lines"));
}
@ -820,7 +820,7 @@ B flines_c2(B d, B w, B x) {
decG(s);
return p;
}
static GLOBAL NFnDesc* importDesc;
STATIC_GLOBAL NFnDesc* importDesc;
@ -863,18 +863,18 @@ B import_c1(B d, B x) {
}
static GLOBAL NFnDesc* fTypeDesc;
static GLOBAL NFnDesc* fCreatedDesc;
static GLOBAL NFnDesc* fAccessedDesc;
static GLOBAL NFnDesc* fModifiedDesc;
static GLOBAL NFnDesc* fSizeDesc;
static GLOBAL NFnDesc* fExistsDesc;
static GLOBAL NFnDesc* fListDesc;
static GLOBAL NFnDesc* fMapBytesDesc;
static GLOBAL NFnDesc* createdirDesc;
static GLOBAL NFnDesc* realpathDesc;
static GLOBAL NFnDesc* renameDesc;
static GLOBAL NFnDesc* removeDesc;
STATIC_GLOBAL NFnDesc* fTypeDesc;
STATIC_GLOBAL NFnDesc* fCreatedDesc;
STATIC_GLOBAL NFnDesc* fAccessedDesc;
STATIC_GLOBAL NFnDesc* fModifiedDesc;
STATIC_GLOBAL NFnDesc* fSizeDesc;
STATIC_GLOBAL NFnDesc* fExistsDesc;
STATIC_GLOBAL NFnDesc* fListDesc;
STATIC_GLOBAL NFnDesc* fMapBytesDesc;
STATIC_GLOBAL NFnDesc* createdirDesc;
STATIC_GLOBAL NFnDesc* realpathDesc;
STATIC_GLOBAL NFnDesc* renameDesc;
STATIC_GLOBAL NFnDesc* removeDesc;
B list_c1(B d, B x) {
return path_list(path_rel(nfn_objU(d), x, "•file.List"));
@ -1248,7 +1248,7 @@ B tErrRaw_c1(B t, B x) {
return x;
}
static GLOBAL B termNS;
STATIC_GLOBAL B termNS;
B getTermNS(void) {
if (termNS.u == 0) {
#define F(X) incG(bi_##X),
@ -1312,7 +1312,7 @@ B nHas_c2(B t, B w, B x) {
decG(w); decG(x);
return m_i32(!q_N(r));
}
static GLOBAL B nsNS;
STATIC_GLOBAL B nsNS;
B getNsNS(void) {
if (nsNS.u == 0) {
#define F(X) incG(bi_##X),
@ -1612,7 +1612,7 @@ DEF_OP2(and) DEF_OP2(or) DEF_OP2(xor)
DEF_OP2(add) DEF_OP2(sub) DEF_OP2(mul)
#undef DEF_OP2
static GLOBAL B bitNS;
STATIC_GLOBAL B bitNS;
B getBitNS(void) {
if (bitNS.u == 0) {
#define F(X) incG(bi_bit##X),
@ -1627,7 +1627,7 @@ B getBitNS(void) {
B getInternalNS(void);
B getMathNS(void);
static GLOBAL Body* file_nsGen;
STATIC_GLOBAL Body* file_nsGen;
#if FFI || FOR_BUILD
#define FFIOPT 1
@ -1732,7 +1732,7 @@ static NOINLINE void initSysDesc() {
extern char* const cbqn_versionString;
#endif
static GLOBAL B platformNS;
STATIC_GLOBAL B platformNS;
static B getPlatformNS(void) {
if (platformNS.u == 0) {

View File

@ -109,8 +109,8 @@ static B toConstant(B x) { // doesn't consume x
}
return bi_N;
}
static GLOBAL NFnDesc* ucwWrapDesc;
static GLOBAL NFnDesc* uc1WrapDesc;
STATIC_GLOBAL NFnDesc* ucwWrapDesc;
STATIC_GLOBAL NFnDesc* uc1WrapDesc;
static B fork_uc1(B t, B o, B x) {
B f = toConstant(c(Fork, t)->f);

View File

@ -32,15 +32,15 @@ void cbqn_heapVerify() {
#endif
static GLOBAL u64 heap_PICounts[t_COUNT];
static GLOBAL u64 heap_PISizes[t_COUNT];
STATIC_GLOBAL u64 heap_PICounts[t_COUNT];
STATIC_GLOBAL u64 heap_PISizes[t_COUNT];
NOINLINE void heap_PIFn(Value* v) {
heap_PICounts[PTY(v)]++;
heap_PISizes[PTY(v)]+= mm_size(v);
}
static GLOBAL u64 heap_PIFreed[128];
STATIC_GLOBAL u64 heap_PIFreed[128];
void heap_PIFreedFn(Value* v) {
heap_PIFreed[v->mmInfo&127]++;
}

View File

@ -613,7 +613,7 @@ NOINLINE B readU16Bits(B x) { usz ia=IA(x); u16* xp=tyarr_ptr(x); i32* rp; B r=m
NOINLINE B readU32Bits(B x) { usz ia=IA(x); u32* xp=tyarr_ptr(x); f64* rp; B r=m_f64arrv(&rp, ia); for (usz i=0; i<ia; i++) rp[i]=xp[i]; return num_squeeze(r); }
NOINLINE B readF32Bits(B x) { usz ia=IA(x); f32* xp=tyarr_ptr(x); f64* rp; B r=m_f64arrv(&rp, ia); for (usz i=0; i<ia; i++) rp[i]=xp[i]; return r; }
static GLOBAL B ffiObjsGlobal;
STATIC_GLOBAL B ffiObjsGlobal;
void genObj(B o, B c, bool anyMut, void* ptr) {
// printFFIType(stdout,o); printf(" = "); printI(c); printf("\n");
if (isC32(o)) { // scalar

View File

@ -144,6 +144,7 @@ typedef size_t ux;
#define STR1(X) STR0(X)
#define INIT_GLOBAL __attribute__((visibility("hidden"))) // global variable set once during initialization, to the same value always
#define GLOBAL INIT_GLOBAL // global variable mutated potentially multiple times, or set to a value referencing the heap
#define STATIC_GLOBAL static // GLOBAL but static
#if USE_REPLXX_IO

View File

@ -27,7 +27,7 @@ GLOBAL u64 mmX_ctrs[64];
#define MMI(X) X
#define ALSZ 20
static GLOBAL u64 nvm_mmap_seed = 0;
STATIC_GLOBAL u64 nvm_mmap_seed = 0;
#ifdef __clang__
#if __clang_major__ <= 12 // old clang versions get stuck in an infinite loop while optimizing this
__attribute__((optnone))

View File

@ -49,9 +49,9 @@ typedef struct AsmStk {
u8* c; // position for next write
u8* e; // position past last writable position
} AsmStk;
static GLOBAL AsmStk asm_ins; // TODO add as root
static GLOBAL AsmStk asm_rel;
static GLOBAL i32 asm_depth = 0;
STATIC_GLOBAL AsmStk asm_ins; // TODO add as root
STATIC_GLOBAL AsmStk asm_rel;
STATIC_GLOBAL i32 asm_depth = 0;
static NOINLINE void asm_allocBuf(AsmStk* stk, u64 sz) {
TAlloc* a = mm_alloc(sizeof(TAlloc) + sz, t_temp);

View File

@ -630,7 +630,7 @@ void bqn_exit(i32 code) {
exit(code);
}
static GLOBAL B load_explain;
STATIC_GLOBAL B load_explain;
B bqn_explain(B str) {
#if NO_EXPLAIN
thrM("Explainer not included in this CBQN build");

View File

@ -20,9 +20,9 @@
#error "Cannot use USE_REPLXX_IO without USE_REPLXX"
#endif
static GLOBAL B replPath, replName;
static GLOBAL Scope* gsc;
static GLOBAL bool repl_initialized = false;
STATIC_GLOBAL B replPath, replName;
STATIC_GLOBAL Scope* gsc;
STATIC_GLOBAL bool repl_initialized = false;
static NOINLINE void repl_init() {
if (repl_initialized) return;
@ -68,8 +68,8 @@ static NOINLINE i64 readInt(char** p) {
#include <errno.h>
#include "utils/cstr.h"
GLOBAL Replxx* global_replxx;
static GLOBAL char* global_histfile;
static GLOBAL u32 cfg_prefixChar = U'\\';
STATIC_GLOBAL char* global_histfile;
STATIC_GLOBAL u32 cfg_prefixChar = U'\\';
static i8 const themes[3][12][3] = {
// {-1,-1,-1} for default/unchanged color, {-1,-1,n} for grayscale 0…23, else RGB 0…5
@ -109,11 +109,11 @@ static NOINLINE i64 readInt(char** p) {
};
typedef i8 Theme[12][3];
static GLOBAL ReplxxColor theme_replxx[12];
STATIC_GLOBAL ReplxxColor theme_replxx[12];
static GLOBAL i32 cfg_theme = 1;
static GLOBAL bool cfg_enableKeyboard = true;
static GLOBAL B cfg_path;
STATIC_GLOBAL i32 cfg_theme = 1;
STATIC_GLOBAL bool cfg_enableKeyboard = true;
STATIC_GLOBAL B cfg_path;
static char* const command_completion[] = {
")ex ",
@ -163,7 +163,7 @@ static NOINLINE i64 readInt(char** p) {
}
extern u32* const dsv_text[];
static GLOBAL B sysvalNames, sysvalNamesNorm;
STATIC_GLOBAL B sysvalNames, sysvalNamesNorm;
NOINLINE void fill_color(ReplxxColor* cols, int s, int e, ReplxxColor col) {
PLAINLOOP for (int i = s; i < e; i++) cols[i] = col;
@ -406,9 +406,9 @@ static NOINLINE i64 readInt(char** p) {
return (TmpState){.s = s, .pos = replace? pos : pos+1};
}
static GLOBAL B b_pv;
static GLOBAL int b_pp;
static GLOBAL bool inBackslash;
STATIC_GLOBAL B b_pv;
STATIC_GLOBAL int b_pp;
STATIC_GLOBAL bool inBackslash;
static void stopBackslash() { inBackslash = false; }
NOINLINE void setPrev(B s, u64 pos) { // consumes
decG(b_pv);
@ -440,7 +440,7 @@ static NOINLINE i64 readInt(char** p) {
B indexOf_c2(B, B, B);
B pick_c1(B, B);
static GLOBAL B b_key, b_val;
STATIC_GLOBAL B b_key, b_val;
void modified_replxx(char** s_res, int* p_res, void* userData) {
if (!cfg_enableKeyboard) return;
CATCH_OOM(return)
@ -579,7 +579,7 @@ void clearImportCache(void);
void switchComp(void);
#endif
static GLOBAL B escape_parser;
STATIC_GLOBAL B escape_parser;
static B simple_unescape(B x) {
if (RARE(escape_parser.u==0)) {
escape_parser = bqn_exec(utf8Decode0("{m←\"Expected surrounding quotes\" ⋄ m!2≤≠𝕩 ⋄ m!\"\"\"\"\"\"≡0‿¯1⊏𝕩 ⋄ s←¬e←<`'\\'=𝕩 ⋄ i‿o←\"\\\"\"nr\"\"\\\"\"\"∾@+10‿13 ⋄ 1↓¯1↓{n←i⊐𝕩\"Unknown escape\"!∧´n≠≠i ⋄ n⊏o}⌾((s/»e)⊸/) s/𝕩}"), bi_N);

View File

@ -2,8 +2,8 @@
#include "h.h"
#include "nfns.h"
static GLOBAL u32 nfn_curr;
static GLOBAL B nfn_list;
STATIC_GLOBAL u32 nfn_curr;
STATIC_GLOBAL B nfn_list;
NFnDesc* registerNFn(B name, FC1 c1, FC2 c2) {
u32 id = nfn_curr++;

View File

@ -100,8 +100,8 @@ void ns_set(B ns, B name, B val) { VTY(ns, t_ns);
static GLOBAL i32* emptyi32ptr;
static GLOBAL B emptyi32obj;
STATIC_GLOBAL i32* emptyi32ptr;
STATIC_GLOBAL B emptyi32obj;
Body* m_nnsDescF(i32 n, char** names) {
if (emptyi32ptr==NULL) gc_add(emptyi32obj = m_i32arrv(&emptyi32ptr, 0));
incByG(emptyi32obj, 2);

View File

@ -196,7 +196,7 @@ void gc_forceGC(bool toplevel) {
#endif
}
static GLOBAL bool gc_wantTopLevelGC;
STATIC_GLOBAL bool gc_wantTopLevelGC;
bool gc_maybeGC(bool toplevel) {
if (gc_depth) return false;
u64 used = mm_heapUsed();

View File

@ -31,7 +31,7 @@ FORCE_INLINE void BN(splitTo)(EmptyValue* c, i64 from, i64 to, bool notEqual) {
}
#if ALLOC_MODE==0 && ENABLE_GC
static GLOBAL bool BN(allocMore_rec);
STATIC_GLOBAL bool BN(allocMore_rec);
#endif
static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) {

View File

@ -381,8 +381,8 @@ static inline B to_chars(const floating_decimal_64 v, const bool sign, const boo
return r;
}
static GLOBAL B fmt_nan, fmt_zero;
static GLOBAL B fmt_inf[2];
STATIC_GLOBAL B fmt_nan, fmt_zero;
STATIC_GLOBAL B fmt_inf[2];
B ryu_d2s(double f) {
const uint64_t bits = double_to_bits(f); // decode the floating-point number, and unify normalized and subnormal cases.

View File

@ -140,7 +140,7 @@ typedef struct NextRequest {
u32 pos2; // ↑ for dyadic; U32_MAX if not wanted
} NextRequest;
static GLOBAL B emptyARMM;
STATIC_GLOBAL B emptyARMM;
Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBlocks, B allBodies, B nameList, Scope* sc, i32 depth, i32 myPos, i32 nsResult) {
assert(sc!=NULL || nsResult==0);
@ -1154,7 +1154,7 @@ void md2Bl_print(FILE* f, B x) { fprintf(f,"{2-modifier block}"); }
B block_decompose(B x) { return m_hvec2(m_i32(1), x); }
#if !defined(_WIN32) && !defined(_WIN64)
static GLOBAL usz pageSizeV;
STATIC_GLOBAL usz pageSizeV;
#endif
usz getPageSize() {