From 9d50e7a584d115089095c6c17fb7c6821ee0cb8e Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 4 Mar 2025 11:55:42 +0100 Subject: [PATCH] add noreturn to functions which call 'exit' --- .vscode/launch.json | 4 ++-- .vscode/tasks.json | 4 ++-- src/error.c | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index c371bbf..da30dab 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "env": { "DEBUG": "1", "ASAN_OPTIONS": "detect_leaks=0", - "UBSAN_OPTIONS": "print_stacktrace=1:halt_on_error=1", + "UBSAN_OPTIONS": "print_stacktrace=1:halt_on_error=1" }, "program": "", "linux": { @@ -20,7 +20,7 @@ "preLaunchTask": "(dbg) compile win-x86_64", "program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}.exe", "cwd": "${workspaceFolder}/bin/win-x86_64/dbg/" - }, + } } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 21aff10..5567efe 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,12 +4,12 @@ { "label": "(dbg) compile linux-x86_64", "type": "shell", - "command": "DEBUG=1 make linux-x86_64", + "command": "DEBUG=1 make linux-x86_64" }, { "label": "(dbg) compile win-x86_64", "type": "shell", - "command": "DEBUG=1 make win-x86_64", + "command": "DEBUG=1 make win-x86_64" } ] } diff --git a/src/error.c b/src/error.c index 7fb5df5..d4da557 100644 --- a/src/error.c +++ b/src/error.c @@ -1,11 +1,10 @@ #include "error.h" +#include #include -#include #include #include - -#include "SDL_messagebox.h" +#include #define PRINT_BUFFER_SIZE 128 // defines the buffer size for printing @@ -50,7 +49,7 @@ void warn(char const* fmt, ...) { (void)fprintf(stderr, "\033[93mW: %s\033[0m\n", buf); } -void error(gamestatus error_code, char const* fmt, ...) { +noreturn void error(gamestatus error_code, char const* fmt, ...) { char buf[PRINT_BUFFER_SIZE] = {0}; write_args(buf, fmt); (void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);