Make all non-extern globals static

This commit is contained in:
Rangi42
2025-07-21 20:14:09 -04:00
parent 8d268e8a8a
commit c83b87e0a0
9 changed files with 26 additions and 21 deletions

View File

@@ -58,7 +58,7 @@ static std::deque<Charmap> charmapList;
static std::unordered_map<std::string, size_t> charmapMap; // Indexes into `charmapList`
static Charmap *currentCharmap;
std::stack<Charmap *> charmapStack;
static std::stack<Charmap *> charmapStack;
bool charmap_ForEach(
void (*mapFunc)(std::string const &),

View File

@@ -38,15 +38,19 @@ struct SectionStackEntry {
std::stack<UnionStackEntry> unionStack;
};
std::stack<UnionStackEntry> currentUnionStack;
std::deque<SectionStackEntry> sectionStack;
std::deque<Section> sectionList;
std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
uint32_t curOffset; // Offset into the current section (see sect_GetSymbolOffset)
Section *currentSection = nullptr;
static uint32_t curOffset; // Offset into the current section (see `sect_GetSymbolOffset`)
static std::deque<SectionStackEntry> sectionStack;
static Section *currentLoadSection = nullptr;
static std::pair<Symbol const *, Symbol const *> currentLoadLabelScopes = {nullptr, nullptr};
int32_t loadOffset; // Offset into the LOAD section's parent (see sect_GetOutputOffset)
static int32_t loadOffset; // Offset into the LOAD section's parent (see sect_GetOutputOffset)
static std::stack<UnionStackEntry> currentUnionStack;
[[nodiscard]]
static bool requireSection() {

View File

@@ -22,20 +22,23 @@
using namespace std::literals;
std::unordered_map<std::string, Symbol> symbols;
std::unordered_set<std::string> purgedSymbols;
static std::unordered_map<std::string, Symbol> symbols;
static std::unordered_set<std::string> purgedSymbols;
static Symbol const *globalScope = nullptr; // Current section's global label scope
static Symbol const *localScope = nullptr; // Current section's local label scope
static Symbol *PCSymbol;
static Symbol *NARGSymbol;
static Symbol *globalScopeSymbol;
static Symbol *localScopeSymbol;
static Symbol *RSSymbol;
static char savedTIME[256];
static char savedDATE[256];
static char savedTIMESTAMP_ISO8601_LOCAL[256];
static char savedTIMESTAMP_ISO8601_UTC[256];
static bool exportAll = false; // -E
bool sym_IsPC(Symbol const *sym) {