Remove redundant (void) parameter declarations

This commit is contained in:
Rangi42
2024-03-01 10:35:50 -05:00
parent 91d22f180e
commit e14ba664ea
38 changed files with 173 additions and 173 deletions

View File

@@ -10,8 +10,8 @@
void charmap_New(char const *name, char const *baseName);
void charmap_Set(char const *name);
void charmap_Push(void);
void charmap_Pop(void);
void charmap_Push();
void charmap_Pop();
void charmap_Add(char *mapping, uint8_t value);
bool charmap_HasChar(char const *input);
void charmap_Convert(char const *input, std::vector<uint8_t> &output);

View File

@@ -7,8 +7,8 @@
extern uint8_t fixPrecision;
uint8_t fix_Precision(void);
double fix_PrecisionFactor(void);
uint8_t fix_Precision();
double fix_PrecisionFactor();
int32_t fix_Sin(int32_t i, int32_t q);
int32_t fix_Cos(int32_t i, int32_t q);
int32_t fix_Tan(int32_t i, int32_t q);

View File

@@ -28,7 +28,7 @@ struct FormatSpec {
bool valid;
};
FormatSpec fmt_NewSpec(void);
FormatSpec fmt_NewSpec();
bool fmt_IsEmpty(FormatSpec const *fmt);
bool fmt_IsValid(FormatSpec const *fmt);
bool fmt_IsFinished(FormatSpec const *fmt);

View File

@@ -44,10 +44,10 @@ extern size_t maxRecursionDepth;
struct MacroArgs;
void fstk_Dump(FileStackNode const *node, uint32_t lineNo);
void fstk_DumpCurrent(void);
FileStackNode *fstk_GetFileStack(void);
void fstk_DumpCurrent();
FileStackNode *fstk_GetFileStack();
// The lifetime of the returned chars is until reaching the end of that file
char const *fstk_GetFileName(void);
char const *fstk_GetFileName();
void fstk_AddIncludePath(char const *s);
void fstk_SetPreIncludeFile(char const *s);
@@ -57,14 +57,14 @@ void fstk_SetPreIncludeFile(char const *s);
*/
std::string *fstk_FindFile(char const *path);
bool yywrap(void);
bool yywrap();
void fstk_RunInclude(char const *path);
void fstk_RunMacro(char const *macroName, MacroArgs *args);
void fstk_RunRept(uint32_t count, int32_t reptLineNo, char *body, size_t size);
void fstk_RunFor(char const *symName, int32_t start, int32_t stop, int32_t step,
int32_t reptLineNo, char *body, size_t size);
void fstk_StopRept(void);
bool fstk_Break(void);
void fstk_StopRept();
bool fstk_Break();
void fstk_NewRecursionDepth(size_t newDepth);
void fstk_Init(char const *mainPath, size_t maxDepth);

View File

@@ -122,17 +122,17 @@ bool lexer_OpenFile(LexerState &state, char const *path);
void lexer_OpenFileView(LexerState &state, char const *path, char *buf, size_t size, uint32_t lineNo);
void lexer_RestartRept(uint32_t lineNo);
void lexer_CleanupState(LexerState &state);
void lexer_Init(void);
void lexer_Init();
void lexer_SetMode(enum LexerMode mode);
void lexer_ToggleStringExpansion(bool enable);
uint32_t lexer_GetIFDepth(void);
void lexer_IncIFDepth(void);
void lexer_DecIFDepth(void);
bool lexer_RanIFBlock(void);
bool lexer_ReachedELSEBlock(void);
void lexer_RunIFBlock(void);
void lexer_ReachELSEBlock(void);
uint32_t lexer_GetIFDepth();
void lexer_IncIFDepth();
void lexer_DecIFDepth();
bool lexer_RanIFBlock();
bool lexer_ReachedELSEBlock();
void lexer_RunIFBlock();
void lexer_ReachELSEBlock();
struct CaptureBody {
uint32_t lineNo;
@@ -140,12 +140,12 @@ struct CaptureBody {
size_t size;
};
void lexer_CheckRecursionDepth(void);
char const *lexer_GetFileName(void);
uint32_t lexer_GetLineNo(void);
uint32_t lexer_GetColNo(void);
void lexer_DumpStringExpansions(void);
int yylex(void);
void lexer_CheckRecursionDepth();
char const *lexer_GetFileName();
uint32_t lexer_GetLineNo();
uint32_t lexer_GetColNo();
void lexer_DumpStringExpansions();
int yylex();
bool lexer_CaptureRept(CaptureBody *capture);
bool lexer_CaptureMacroBody(CaptureBody *capture);

View File

@@ -12,20 +12,20 @@
struct MacroArgs;
MacroArgs *macro_GetCurrentArgs(void);
MacroArgs *macro_NewArgs(void);
MacroArgs *macro_GetCurrentArgs();
MacroArgs *macro_NewArgs();
void macro_AppendArg(MacroArgs *args, char *s);
void macro_UseNewArgs(MacroArgs *args);
void macro_FreeArgs(MacroArgs *args);
char const *macro_GetArg(uint32_t i);
char const *macro_GetAllArgs(void);
char const *macro_GetAllArgs();
uint32_t macro_GetUniqueID(void);
char const *macro_GetUniqueIDStr(void);
uint32_t macro_GetUniqueID();
char const *macro_GetUniqueIDStr();
void macro_SetUniqueID(uint32_t id);
uint32_t macro_UseNewUniqueID(void);
uint32_t macro_UndefUniqueID(void);
uint32_t macro_UseNewUniqueID();
uint32_t macro_UndefUniqueID();
void macro_ShiftCurrentArgs(int32_t count);
uint32_t macro_NbArgs(void);
uint32_t macro_NbArgs();
#endif // RGBDS_MACRO_H

View File

@@ -13,7 +13,7 @@ void opt_L(bool optimize);
void opt_W(char *flag);
void opt_Parse(char *option);
void opt_Push(void);
void opt_Pop(void);
void opt_Push();
void opt_Pop();
#endif // RGBDS_OPT_H

View File

@@ -17,6 +17,6 @@ void out_ReplaceNode(FileStackNode *node);
void out_SetFileName(char *s);
void out_CreatePatch(uint32_t type, Expression const *expr, uint32_t ofs, uint32_t pcShift);
void out_CreateAssert(enum AssertionType type, Expression const *expr, char const *message, uint32_t ofs);
void out_WriteObject(void);
void out_WriteObject();
#endif // RGBDS_ASM_OUTPUT_H

View File

@@ -55,18 +55,18 @@ void sect_NewSection(char const *name, enum SectionType type, uint32_t org,
SectionSpec const *attributes, enum SectionModifier mod);
void sect_SetLoadSection(char const *name, enum SectionType type, uint32_t org,
SectionSpec const *attributes, enum SectionModifier mod);
void sect_EndLoadSection(void);
void sect_EndLoadSection();
Section *sect_GetSymbolSection(void);
uint32_t sect_GetSymbolOffset(void);
uint32_t sect_GetOutputOffset(void);
Section *sect_GetSymbolSection();
uint32_t sect_GetSymbolOffset();
uint32_t sect_GetOutputOffset();
uint32_t sect_GetAlignBytes(uint8_t alignment, uint16_t offset);
void sect_AlignPC(uint8_t alignment, uint16_t offset);
void sect_StartUnion(void);
void sect_NextUnionMember(void);
void sect_EndUnion(void);
void sect_CheckUnionClosed(void);
void sect_StartUnion();
void sect_NextUnionMember();
void sect_EndUnion();
void sect_CheckUnionClosed();
void sect_AbsByte(uint8_t b);
void sect_AbsByteGroup(uint8_t const *s, size_t length);
@@ -81,9 +81,9 @@ void sect_PCRelByte(Expression *expr, uint32_t pcShift);
void sect_BinaryFile(char const *s, int32_t startPos);
void sect_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length);
void sect_EndSection(void);
void sect_PushSection(void);
void sect_PopSection(void);
void sect_EndSection();
void sect_PushSection();
void sect_PopSection();
bool sect_IsSizeKnown(Section const NONNULL(name));

View File

@@ -42,12 +42,12 @@ struct Symbol {
union {
// If sym_IsNumeric
int32_t value;
int32_t (*numCallback)(void); // If hasCallback
int32_t (*numCallback)(); // If hasCallback
// For SYM_MACRO
strValue macro;
// For SYM_EQUS
strValue equs;
char const *(*strCallback)(void); // If hasCallback
char const *(*strCallback)(); // If hasCallback
};
uint32_t ID; // ID of the symbol in the object file (-1 if none)
@@ -109,13 +109,13 @@ int32_t sym_GetValue(Symbol const *sym);
void sym_SetExportAll(bool set);
Symbol *sym_AddLocalLabel(char const *symName);
Symbol *sym_AddLabel(char const *symName);
Symbol *sym_AddAnonLabel(void);
Symbol *sym_AddAnonLabel();
void sym_WriteAnonLabelName(char buf[MIN_NB_ELMS(MAXSYMLEN + 1)], uint32_t ofs, bool neg);
void sym_Export(char const *symName);
Symbol *sym_AddEqu(char const *symName, int32_t value);
Symbol *sym_RedefEqu(char const *symName, int32_t value);
Symbol *sym_AddVar(char const *symName, int32_t value);
uint32_t sym_GetPCValue(void);
uint32_t sym_GetPCValue();
uint32_t sym_GetConstantSymValue(Symbol const *sym);
uint32_t sym_GetConstantValue(char const *symName);
// Find a symbol by exact name, bypassing expansion checks
@@ -124,7 +124,7 @@ Symbol *sym_FindExactSymbol(char const *symName);
Symbol *sym_FindScopedSymbol(char const *symName);
// Find a scoped symbol by name; do not return `@` or `_NARG` when they have no value
Symbol *sym_FindScopedValidSymbol(char const *symName);
Symbol const *sym_GetPC(void);
Symbol const *sym_GetPC();
Symbol *sym_AddMacro(char const *symName, int32_t defLineNo, char *body, size_t size);
Symbol *sym_Ref(char const *symName);
Symbol *sym_AddString(char const *symName, char const *value);
@@ -133,7 +133,7 @@ void sym_Purge(std::string const &symName);
void sym_Init(time_t now);
// Functions to save and restore the current symbol scope.
char const *sym_GetCurrentSymbolScope(void);
char const *sym_GetCurrentSymbolScope();
void sym_SetCurrentSymbolScope(char const *newScope);
#endif // RGBDS_SYMBOL_H

View File

@@ -20,7 +20,7 @@
#define attr_(...)
// This seems to generate similar code to __builtin_unreachable, despite different semantics
// Note that executing this is undefined behavior (declared [[noreturn]], but does return)
[[noreturn]] static inline void unreachable_(void) {}
[[noreturn]] static inline void unreachable_() {}
#endif
// Use builtins whenever possible, and shim them otherwise

View File

@@ -9,9 +9,9 @@
extern uint64_t nbSectionsToAssign;
// Assigns all sections a slice of the address space
void assign_AssignSections(void);
void assign_AssignSections();
// `free`s all assignment memory that was allocated
void assign_Cleanup(void);
void assign_Cleanup();
#endif // RGBDS_LINK_ASSIGN_H

View File

@@ -15,12 +15,12 @@ void obj_ReadFile(char const *fileName, unsigned int i);
/*
* Perform validation on the object files' contents
*/
void obj_DoSanityChecks(void);
void obj_DoSanityChecks();
/*
* Evaluate all assertions
*/
void obj_CheckAssertions(void);
void obj_CheckAssertions();
/*
* Sets up object file reading
@@ -31,6 +31,6 @@ void obj_Setup(unsigned int nbFiles);
/*
* `free`s all object memory that was allocated.
*/
void obj_Cleanup(void);
void obj_Cleanup();
#endif // RGBDS_LINK_OBJECT_H

View File

@@ -24,6 +24,6 @@ Section const *out_OverlappingSection(Section const *section);
/*
* Writes all output (bin, sym, map) files.
*/
void out_WriteFiles(void);
void out_WriteFiles();
#endif // RGBDS_LINK_OUTPUT_H

View File

@@ -28,6 +28,6 @@ void patch_CheckAssertions(std::deque<Assertion> &assertions);
/*
* Applies all SECTIONs' patches to them
*/
void patch_ApplyPatches(void);
void patch_ApplyPatches();
#endif // RGBDS_LINK_PATCH_H

View File

@@ -76,6 +76,6 @@ Section *sect_GetSection(std::string const &name);
/*
* Checks if all sections meet reasonable criteria, such as max size
*/
void sect_DoSanityChecks(void);
void sect_DoSanityChecks();
#endif // RGBDS_LINK_SECTION_H

View File

@@ -9,7 +9,7 @@ extern "C" {
#define PACKAGE_VERSION_MINOR 7
#define PACKAGE_VERSION_PATCH 0
char const *get_package_version_string(void);
char const *get_package_version_string();
}

View File

@@ -78,12 +78,12 @@ void charmap_Set(char const *name)
currentCharmap = &search->second;
}
void charmap_Push(void)
void charmap_Push()
{
charmapStack.push(currentCharmap);
}
void charmap_Pop(void)
void charmap_Pop()
{
if (charmapStack.empty()) {
error("No entries in the charmap stack\n");

View File

@@ -23,12 +23,12 @@
uint8_t fixPrecision;
uint8_t fix_Precision(void)
uint8_t fix_Precision()
{
return fixPrecision;
}
double fix_PrecisionFactor(void)
double fix_PrecisionFactor()
{
return pow(2.0, fixPrecision);
}

View File

@@ -12,7 +12,7 @@
#include "asm/format.hpp"
#include "asm/warning.hpp"
FormatSpec fmt_NewSpec(void)
FormatSpec fmt_NewSpec()
{
FormatSpec fmt = {};

View File

@@ -92,7 +92,7 @@ void fstk_Dump(FileStackNode const *node, uint32_t lineNo)
fprintf(stderr, "(%" PRIu32 ")", lineNo);
}
void fstk_DumpCurrent(void)
void fstk_DumpCurrent()
{
if (contextStack.empty()) {
fputs("at top level", stderr);
@@ -101,7 +101,7 @@ void fstk_DumpCurrent(void)
fstk_Dump(contextStack.top().fileInfo, lexer_GetLineNo());
}
FileStackNode *fstk_GetFileStack(void)
FileStackNode *fstk_GetFileStack()
{
if (contextStack.empty())
return nullptr;
@@ -116,7 +116,7 @@ FileStackNode *fstk_GetFileStack(void)
return topNode;
}
char const *fstk_GetFileName(void)
char const *fstk_GetFileName()
{
// Iterating via the nodes themselves skips nested REPTs
FileStackNode const *node = contextStack.top().fileInfo;
@@ -188,7 +188,7 @@ std::string *fstk_FindFile(char const *path)
return nullptr;
}
bool yywrap(void)
bool yywrap()
{
uint32_t ifDepth = lexer_GetIFDepth();
@@ -318,7 +318,7 @@ void fstk_RunInclude(char const *path)
// Similar to `fstk_RunInclude`, but not subject to `-MG`, and
// calling `lexer_SetState` instead of `lexer_SetStateAtEOL`.
static void runPreIncludeFile(void)
static void runPreIncludeFile()
{
if (!preIncludeName)
return;
@@ -479,13 +479,13 @@ void fstk_RunFor(char const *symName, int32_t start, int32_t stop, int32_t step,
context.forName = symName;
}
void fstk_StopRept(void)
void fstk_StopRept()
{
// Prevent more iterations
contextStack.top().nbReptIters = 0;
}
bool fstk_Break(void)
bool fstk_Break()
{
if (contextStack.top().fileInfo->type != NODE_REPT) {
error("BREAK can only be used inside a REPT/FOR block\n");

View File

@@ -320,23 +320,23 @@ static void initState(LexerState &state)
state.expansions.clear();
}
static void nextLine(void)
static void nextLine()
{
lexerState->lineNo++;
lexerState->colNo = 1;
}
uint32_t lexer_GetIFDepth(void)
uint32_t lexer_GetIFDepth()
{
return lexerState->ifStack.size();
}
void lexer_IncIFDepth(void)
void lexer_IncIFDepth()
{
lexerState->ifStack.push_front({ .ranIfBlock = false, .reachedElseBlock = false });
}
void lexer_DecIFDepth(void)
void lexer_DecIFDepth()
{
if (lexerState->ifStack.empty())
fatalerror("Found ENDC outside an IF construct\n");
@@ -344,22 +344,22 @@ void lexer_DecIFDepth(void)
lexerState->ifStack.pop_front();
}
bool lexer_RanIFBlock(void)
bool lexer_RanIFBlock()
{
return lexerState->ifStack.front().ranIfBlock;
}
bool lexer_ReachedELSEBlock(void)
bool lexer_ReachedELSEBlock()
{
return lexerState->ifStack.front().reachedElseBlock;
}
void lexer_RunIFBlock(void)
void lexer_RunIFBlock()
{
lexerState->ifStack.front().ranIfBlock = true;
}
void lexer_ReachELSEBlock(void)
void lexer_ReachELSEBlock()
{
lexerState->ifStack.front().reachedElseBlock = true;
}
@@ -484,7 +484,7 @@ void lexer_ToggleStringExpansion(bool enable)
// Functions for the actual lexer to obtain characters
static void reallocCaptureBuf(void)
static void reallocCaptureBuf()
{
if (lexerState->captureCapacity == SIZE_MAX)
fatalerror("Cannot grow capture buffer past %zu bytes\n", SIZE_MAX);
@@ -517,7 +517,7 @@ static void beginExpansion(char const *str, bool owned, char const *name)
});
}
void lexer_CheckRecursionDepth(void)
void lexer_CheckRecursionDepth()
{
if (lexerState->expansions.size() > maxRecursionDepth + 1)
fatalerror("Recursion limit (%zu) exceeded\n", maxRecursionDepth);
@@ -536,13 +536,13 @@ static bool isMacroChar(char c)
}
// forward declarations for readBracketedMacroArgNum
static int peek(void);
static void shiftChar(void);
static int peek();
static void shiftChar();
static uint32_t readNumber(int radix, uint32_t baseValue);
static bool startsIdentifier(int c);
static bool continuesIdentifier(int c);
static uint32_t readBracketedMacroArgNum(void)
static uint32_t readBracketedMacroArgNum()
{
bool disableMacroArgs = lexerState->disableMacroArgs;
bool disableInterpolation = lexerState->disableInterpolation;
@@ -709,10 +709,10 @@ static int peekInternal(uint8_t distance)
}
// forward declarations for peek
static void shiftChar(void);
static void shiftChar();
static char const *readInterpolation(size_t depth);
static int peek(void)
static int peek()
{
int c = peekInternal(0);
@@ -758,7 +758,7 @@ static int peek(void)
return c;
}
static void shiftChar(void)
static void shiftChar()
{
if (lexerState->capturing) {
if (lexerState->captureBuf) {
@@ -802,7 +802,7 @@ restart:
}
}
static int nextChar(void)
static int nextChar()
{
int c = peek();
@@ -820,22 +820,22 @@ static void handleCRLF(int c)
// "Services" provided by the lexer to the rest of the program
char const *lexer_GetFileName(void)
char const *lexer_GetFileName()
{
return lexerState ? lexerState->path : nullptr;
}
uint32_t lexer_GetLineNo(void)
uint32_t lexer_GetLineNo()
{
return lexerState->lineNo;
}
uint32_t lexer_GetColNo(void)
uint32_t lexer_GetColNo()
{
return lexerState->colNo;
}
void lexer_DumpStringExpansions(void)
void lexer_DumpStringExpansions()
{
if (!lexerState)
return;
@@ -848,7 +848,7 @@ void lexer_DumpStringExpansions(void)
}
// Discards a block comment
static void discardBlockComment(void)
static void discardBlockComment()
{
lexerState->disableMacroArgs = true;
lexerState->disableInterpolation = true;
@@ -890,7 +890,7 @@ finish:
// Function to discard all of a line's comments
static void discardComment(void)
static void discardComment()
{
lexerState->disableMacroArgs = true;
lexerState->disableInterpolation = true;
@@ -906,7 +906,7 @@ static void discardComment(void)
// Function to read a line continuation
static void readLineContinuation(void)
static void readLineContinuation()
{
for (;;) {
int c = peek();
@@ -1030,7 +1030,7 @@ static uint32_t readFractionalPart(uint32_t integer)
char binDigits[2];
static uint32_t readBinaryNumber(void)
static uint32_t readBinaryNumber()
{
uint32_t value = 0;
@@ -1055,7 +1055,7 @@ static uint32_t readBinaryNumber(void)
return value;
}
static uint32_t readHexNumber(void)
static uint32_t readHexNumber()
{
uint32_t value = 0;
bool empty = true;
@@ -1089,7 +1089,7 @@ static uint32_t readHexNumber(void)
char gfxDigits[4];
static uint32_t readGfxConstant(void)
static uint32_t readGfxConstant()
{
uint32_t bitPlaneLower = 0, bitPlaneUpper = 0;
uint8_t width = 0;
@@ -1606,9 +1606,9 @@ finish:
// Lexer core
static int yylex_SKIP_TO_ENDC(void); // forward declaration for yylex_NORMAL
static int yylex_SKIP_TO_ENDC(); // forward declaration for yylex_NORMAL
static int yylex_NORMAL(void)
static int yylex_NORMAL()
{
for (;;) {
int c = nextChar();
@@ -1909,7 +1909,7 @@ static int yylex_NORMAL(void)
}
}
static int yylex_RAW(void)
static int yylex_RAW()
{
// This is essentially a modified `appendStringLiteral`
size_t parenDepth = 0;
@@ -2168,17 +2168,17 @@ finish:
return token;
}
static int yylex_SKIP_TO_ELIF(void)
static int yylex_SKIP_TO_ELIF()
{
return skipIfBlock(false);
}
static int yylex_SKIP_TO_ENDC(void)
static int yylex_SKIP_TO_ENDC()
{
return skipIfBlock(true);
}
static int yylex_SKIP_TO_ENDR(void)
static int yylex_SKIP_TO_ENDR()
{
lexer_SetMode(LEXER_NORMAL);
int depth = 1;
@@ -2255,7 +2255,7 @@ finish:
return T_EOF;
}
int yylex(void)
int yylex()
{
if (lexerState->atLineStart && lexerStateEOL) {
lexer_SetState(lexerStateEOL);
@@ -2268,7 +2268,7 @@ int yylex(void)
if (lexerState->atLineStart && lexerState->expansions.empty())
nextLine();
static int (* const lexerModeFuncs[NB_LEXER_MODES])(void) = {
static int (* const lexerModeFuncs[NB_LEXER_MODES])() = {
yylex_NORMAL,
yylex_RAW,
yylex_SKIP_TO_ELIF,

View File

@@ -27,12 +27,12 @@ static uint32_t maxUniqueID = 0;
static char uniqueIDBuf[] = "_u4294967295"; // UINT32_MAX
static char *uniqueIDPtr = nullptr;
MacroArgs *macro_GetCurrentArgs(void)
MacroArgs *macro_GetCurrentArgs()
{
return macroArgs;
}
MacroArgs *macro_NewArgs(void)
MacroArgs *macro_NewArgs()
{
MacroArgs *args = new(std::nothrow) MacroArgs();
@@ -73,7 +73,7 @@ char const *macro_GetArg(uint32_t i)
return realIndex >= macroArgs->args.size() ? nullptr : macroArgs->args[realIndex];
}
char const *macro_GetAllArgs(void)
char const *macro_GetAllArgs()
{
if (!macroArgs)
return nullptr;
@@ -110,12 +110,12 @@ char const *macro_GetAllArgs(void)
return str;
}
uint32_t macro_GetUniqueID(void)
uint32_t macro_GetUniqueID()
{
return uniqueID;
}
char const *macro_GetUniqueIDStr(void)
char const *macro_GetUniqueIDStr()
{
// Generate a new unique ID on the first use of `\@`
if (uniqueID == 0)
@@ -137,14 +137,14 @@ void macro_SetUniqueID(uint32_t id)
}
}
uint32_t macro_UseNewUniqueID(void)
uint32_t macro_UseNewUniqueID()
{
// A new ID will be generated on the first use of `\@`
macro_SetUniqueID(0);
return uniqueID;
}
uint32_t macro_UndefUniqueID(void)
uint32_t macro_UndefUniqueID()
{
// No ID will be generated; use of `\@` is an error
macro_SetUniqueID((uint32_t)-1);
@@ -167,7 +167,7 @@ void macro_ShiftCurrentArgs(int32_t count)
}
}
uint32_t macro_NbArgs(void)
uint32_t macro_NbArgs()
{
return macroArgs->args.size() - macroArgs->shift;
}

View File

@@ -43,13 +43,13 @@
// There are known, non-trivial to fix leaks. We would still like to have `make develop'
// detect memory corruption, though.
extern "C" {
char const *__asan_default_options(void) { return "detect_leaks=0"; }
char const *__asan_default_options() { return "detect_leaks=0"; }
}
#endif
// Old Bison versions (confirmed for 2.3) do not forward-declare `yyparse` in the generated header
// Unfortunately, macOS still ships 2.3, which is from 2008...
int yyparse(void);
int yyparse();
FILE *dependfile = nullptr;
bool generatedMissingIncludes = false;
@@ -125,7 +125,7 @@ static option const longopts[] = {
{ nullptr, no_argument, nullptr, 0 }
};
static void printUsage(void)
static void printUsage()
{
fputs(
"Usage: rgbasm [-EHhLlVvw] [-b chars] [-D name[=value]] [-g chars] [-I path]\n"

View File

@@ -239,7 +239,7 @@ void opt_Parse(char *s)
}
}
void opt_Push(void)
void opt_Push()
{
OptStackEntry entry;
@@ -273,7 +273,7 @@ void opt_Push(void)
stack.push(entry);
}
void opt_Pop(void)
void opt_Pop()
{
if (stack.empty()) {
error("No entries in the option stack\n");

View File

@@ -349,7 +349,7 @@ static void registerUnregisteredSymbol(Symbol *symbol)
}
// Write an objectfile
void out_WriteObject(void)
void out_WriteObject()
{
FILE *f;

View File

@@ -51,7 +51,7 @@ char const *currentLoadScope = nullptr;
int32_t loadOffset; // Offset into the LOAD section's parent (see sect_GetOutputOffset)
// A quick check to see if we have an initialized section
attr_(warn_unused_result) static bool checksection(void)
attr_(warn_unused_result) static bool checksection()
{
if (currentSection)
return true;
@@ -62,7 +62,7 @@ attr_(warn_unused_result) static bool checksection(void)
// A quick check to see if we have an initialized section that can contain
// this much initialized data
attr_(warn_unused_result) static bool checkcodesection(void)
attr_(warn_unused_result) static bool checkcodesection()
{
if (!checksection())
return false;
@@ -367,7 +367,7 @@ static Section *getSection(char const *name, enum SectionType type, uint32_t org
}
// Set the current section
static void changeSection(void)
static void changeSection()
{
if (!currentUnionStack.empty())
fatalerror("Cannot change the section within a UNION\n");
@@ -431,7 +431,7 @@ void sect_SetLoadSection(char const *name, enum SectionType type, uint32_t org,
currentLoadSection = sect;
}
void sect_EndLoadSection(void)
void sect_EndLoadSection()
{
if (!currentLoadSection) {
error("Found `ENDL` outside of a `LOAD` block\n");
@@ -445,18 +445,18 @@ void sect_EndLoadSection(void)
sym_SetCurrentSymbolScope(currentLoadScope);
}
Section *sect_GetSymbolSection(void)
Section *sect_GetSymbolSection()
{
return currentLoadSection ? currentLoadSection : currentSection;
}
// The offset into the section above
uint32_t sect_GetSymbolOffset(void)
uint32_t sect_GetSymbolOffset()
{
return curOffset;
}
uint32_t sect_GetOutputOffset(void)
uint32_t sect_GetOutputOffset()
{
return curOffset + loadOffset;
}
@@ -547,7 +547,7 @@ static void createPatch(enum PatchType type, Expression const *expr, uint32_t pc
out_CreatePatch(type, expr, sect_GetOutputOffset(), pcShift);
}
void sect_StartUnion(void)
void sect_StartUnion()
{
// Important info: currently, UNION and LOAD cannot interact, since UNION is prohibited in
// "code" sections, whereas LOAD is restricted to them.
@@ -566,7 +566,7 @@ void sect_StartUnion(void)
currentUnionStack.push({ .start = curOffset, .size = 0 });
}
static void endUnionMember(void)
static void endUnionMember()
{
UnionStackEntry &member = currentUnionStack.top();
uint32_t memberSize = curOffset - member.start;
@@ -576,7 +576,7 @@ static void endUnionMember(void)
curOffset = member.start;
}
void sect_NextUnionMember(void)
void sect_NextUnionMember()
{
if (currentUnionStack.empty()) {
error("Found NEXTU outside of a UNION construct\n");
@@ -585,7 +585,7 @@ void sect_NextUnionMember(void)
endUnionMember();
}
void sect_EndUnion(void)
void sect_EndUnion()
{
if (currentUnionStack.empty()) {
error("Found ENDU outside of a UNION construct\n");
@@ -596,7 +596,7 @@ void sect_EndUnion(void)
currentUnionStack.pop();
}
void sect_CheckUnionClosed(void)
void sect_CheckUnionClosed()
{
if (!currentUnionStack.empty())
error("Unterminated UNION construct\n");
@@ -920,7 +920,7 @@ cleanup:
}
// Section stack routines
void sect_PushSection(void)
void sect_PushSection()
{
sectionStack.push_front({
.section = currentSection,
@@ -938,7 +938,7 @@ void sect_PushSection(void)
std::swap(currentUnionStack, sectionStack.front().unionStack);
}
void sect_PopSection(void)
void sect_PopSection()
{
if (sectionStack.empty())
fatalerror("No entries in the section stack\n");
@@ -958,7 +958,7 @@ void sect_PopSection(void)
std::swap(currentUnionStack, entry.unionStack);
}
void sect_EndSection(void)
void sect_EndSection()
{
if (!currentSection)
fatalerror("Cannot end the section outside of a SECTION\n");

View File

@@ -49,7 +49,7 @@ void sym_ForEach(void (*callback)(Symbol *))
callback(&it.second);
}
static int32_t Callback_NARG(void)
static int32_t Callback_NARG()
{
if (!macro_GetCurrentArgs()) {
error("_NARG does not make sense outside of a macro\n");
@@ -58,7 +58,7 @@ static int32_t Callback_NARG(void)
return macro_NbArgs();
}
static int32_t CallbackPC(void)
static int32_t CallbackPC()
{
Section const *section = sect_GetSymbolSection();
@@ -188,7 +188,7 @@ Symbol *sym_FindScopedValidSymbol(char const *symName)
return sym;
}
Symbol const *sym_GetPC(void)
Symbol const *sym_GetPC()
{
return PCSymbol;
}
@@ -221,7 +221,7 @@ void sym_Purge(std::string const &symName)
}
}
uint32_t sym_GetPCValue(void)
uint32_t sym_GetPCValue()
{
Section const *sect = sect_GetSymbolSection();
@@ -260,7 +260,7 @@ uint32_t sym_GetConstantValue(char const *symName)
return 0;
}
char const *sym_GetCurrentSymbolScope(void)
char const *sym_GetCurrentSymbolScope()
{
return labelScope;
}
@@ -492,7 +492,7 @@ Symbol *sym_AddLabel(char const *symName)
static uint32_t anonLabelID;
// Add an anonymous label
Symbol *sym_AddAnonLabel(void)
Symbol *sym_AddAnonLabel()
{
if (anonLabelID == UINT32_MAX) {
error("Only %" PRIu32 " anonymous labels can be created!", anonLabelID);

View File

@@ -56,7 +56,7 @@ static option const longopts[] = {
{ nullptr, no_argument, nullptr, 0 }
};
static void printUsage(void)
static void printUsage()
{
fputs(
"Usage: rgbfix [-jOsVv] [-C | -c] [-f <fix_spec>] [-i <game_id>] [-k <licensee>]\n"
@@ -158,7 +158,7 @@ enum MbcType {
MBC_BAD_RANGE, // MBC number out of range
};
static void printAcceptedMBCNames(void)
static void printAcceptedMBCNames()
{
fputs("\tROM ($00) [aka ROM_ONLY]\n", stderr);
fputs("\tMBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)\n", stderr);
@@ -776,7 +776,7 @@ static bool sgb = false; // If false, SGB flags are left alone
static const char *title = nullptr;
static uint8_t titleLen;
static uint8_t maxTitleLen(void)
static uint8_t maxTitleLen()
{
return gameID ? 11 : model != DMG ? 15 : 16;
}

View File

@@ -143,7 +143,7 @@ static option const longopts[] = {
{nullptr, no_argument, nullptr, 0 }
};
static void printUsage(void) {
static void printUsage() {
fputs("Usage: rgbgfx [-r stride] [-CmOuVZ] [-v [-v ...]] [-a <attr_map> | -A]\n"
" [-b <base_ids>] [-c <colors>] [-d <depth>] [-L <slice>] [-N <nb_tiles>]\n"
" [-n <nb_pals>] [-o <out_file>] [-p <pal_file> | -P] [-q <pal_map> | -Q]\n"

View File

@@ -36,7 +36,7 @@ FreeSpace *memory[SECTTYPE_INVALID];
uint64_t nbSectionsToAssign;
// Init the free space-modelling structs
static void initFreeSpace(void)
static void initFreeSpace()
{
for (enum SectionType type : EnumSeq(SECTTYPE_INVALID)) {
memory[type] = (FreeSpace *)malloc(sizeof(*memory[type]) * nbbanks(type));
@@ -360,7 +360,7 @@ static void categorizeSection(Section *section)
nbSectionsToAssign++;
}
void assign_AssignSections(void)
void assign_AssignSections()
{
verbosePrint("Beginning assignment...\n");
@@ -418,7 +418,7 @@ max_out:
unreachable_();
}
void assign_Cleanup(void)
void assign_Cleanup()
{
for (enum SectionType type : EnumSeq(SECTTYPE_INVALID)) {
for (uint32_t bank = 0; bank < nbbanks(type); bank++) {

View File

@@ -191,7 +191,7 @@ static option const longopts[] = {
{ nullptr, no_argument, nullptr, 0 }
};
static void printUsage(void)
static void printUsage()
{
fputs(
"Usage: rgblink [-dMtVvwx] [-l script] [-m map_file] [-n sym_file]\n"
@@ -336,7 +336,7 @@ next:
}
}
[[noreturn]] void reportErrors(void) {
[[noreturn]] void reportErrors() {
fprintf(stderr, "Linking failed with %" PRIu32 " error%s\n",
nbErrors, nbErrors == 1 ? "" : "s");
exit(1);

View File

@@ -525,12 +525,12 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
fclose(file);
}
void obj_DoSanityChecks(void)
void obj_DoSanityChecks()
{
sect_DoSanityChecks();
}
void obj_CheckAssertions(void)
void obj_CheckAssertions()
{
patch_CheckAssertions(assertions);
}
@@ -548,7 +548,7 @@ static void freeSection(Section *section)
};
}
void obj_Cleanup(void)
void obj_Cleanup()
{
sect_ForEach(freeSection);
}

View File

@@ -103,7 +103,7 @@ Section const *out_OverlappingSection(Section const *section)
* Performs sanity checks on the overlay file.
* @return The number of ROM banks in the overlay file
*/
static uint32_t checkOverlaySize(void)
static uint32_t checkOverlaySize()
{
if (!overlayFile)
return 0;
@@ -192,7 +192,7 @@ static void writeBank(std::deque<Section const *> *bankSections, uint16_t baseOf
}
// Writes a ROM file to the output.
static void writeROM(void)
static void writeROM()
{
if (outputFileName) {
if (strcmp(outputFileName, "-")) {
@@ -450,7 +450,7 @@ static void writeMapBank(SortedSections const &sectList, enum SectionType type,
/*
* Write the total used and free space by section type to the map file
*/
static void writeMapSummary(void)
static void writeMapSummary()
{
fputs("SUMMARY:\n", mapFile);
@@ -500,7 +500,7 @@ static void writeMapSummary(void)
}
// Writes the sym file, if applicable.
static void writeSym(void)
static void writeSym()
{
if (!symFileName)
return;
@@ -527,7 +527,7 @@ static void writeSym(void)
}
// Writes the map file, if applicable.
static void writeMap(void)
static void writeMap()
{
if (!mapFileName)
return;
@@ -553,7 +553,7 @@ static void writeMap(void)
fclose(mapFile);
}
void out_WriteFiles(void)
void out_WriteFiles()
{
writeROM();
writeSym();

View File

@@ -505,7 +505,7 @@ static void applyPatches(Section *section)
applyFilePatches(component, section);
}
void patch_ApplyPatches(void)
void patch_ApplyPatches()
{
sect_ForEach(applyPatches);
}

View File

@@ -34,21 +34,21 @@
using namespace std::literals;
static void includeFile(std::string &&path);
static void incLineNo(void);
static void incLineNo();
static void setSectionType(SectionType type);
static void setSectionType(SectionType type, uint32_t bank);
static void setAddr(uint32_t addr);
static void makeAddrFloating(void);
static void makeAddrFloating();
static void alignTo(uint32_t alignment, uint32_t offset);
static void pad(uint32_t length);
static void placeSection(std::string const &name, bool isOptional);
static yy::parser::symbol_type yylex(void);
static yy::parser::symbol_type yylex();
struct Keyword {
std::string_view name;
yy::parser::symbol_type (* tokenGen)(void);
yy::parser::symbol_type (* tokenGen)();
};
}
@@ -144,7 +144,7 @@ static void includeFile(std::string &&path) {
}
}
static void incLineNo(void) {
static void incLineNo() {
++lexerStack.back().lineNo;
}
@@ -184,7 +184,7 @@ static uint8_t parseHexDigit(int c) {
}
}
yy::parser::symbol_type yylex(void) {
yy::parser::symbol_type yylex() {
try_again: // Can't use a `do {} while(0)` loop, otherwise compilers (wrongly) think it can end.
auto &context = lexerStack.back();
auto c = context.file.sbumpc();
@@ -397,7 +397,7 @@ static void setAddr(uint32_t addr) {
isPcFloating = false;
}
static void makeAddrFloating(void) {
static void makeAddrFloating() {
auto const &context = lexerStack.back();
if (activeType == SECTTYPE_INVALID) {
scriptError(context, "Cannot make the current address floating: no memory region is active");

View File

@@ -266,7 +266,7 @@ static void doSanityChecks(Section *section)
}
}
void sect_DoSanityChecks(void)
void sect_DoSanityChecks()
{
sect_ForEach(doSanityChecks);
}

View File

@@ -13,7 +13,7 @@
#define BUILD_VERSION_STRING "@GIT_REV@"
#endif
char const *get_package_version_string(void)
char const *get_package_version_string()
{
// The following conditional should be simplified by the compiler.
if (strlen(BUILD_VERSION_STRING) == 0) {