From 1475601f6aa3238fbae7f54c84b14a053566a967 Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Sun, 29 Jun 2025 23:00:23 -0500 Subject: [PATCH] Marked the sync functions as noreturn so GCC knows this and fixed an incorrect function call to ParserExpectList. --- src/parser.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/parser.c b/src/parser.c index b97beec..d2c91fc 100644 --- a/src/parser.c +++ b/src/parser.c @@ -23,9 +23,11 @@ Token* ParserExpect(TokenType type); Token* ParserExpectList(int count, ...); Token* ParserWant(TokenType type); void ParserExpectLineEnd(void); -void ParserSync(char* format, ...); -void ParserSyncExpect(TokenType expected, TokenType found); -void ParserSyncMessage(char* message); +//Some more on atrributes: +//https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Function-Attributes.html#Function%20Attributes +void ParserSync(char* format, ...) __attribute__ ((noreturn)); +void ParserSyncExpect(TokenType expected, TokenType found) __attribute__ ((noreturn)); +void ParserSyncMessage(char* message) __attribute__ ((noreturn)); Instruction* ParserCreateInstruction(void); Instructions* ParseTokens(Array* tokens) { @@ -109,7 +111,7 @@ void ParserHandleMnemonic(Mnemonics mnemonic) { case ADD: inst->ParameterCount = 2; - PARSER_EXPECT_LIST(LineEnd, Colon, Comma); + ParserExpects(LineEnd, Colon, Comma); break; default: