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

@@ -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);