add noreturn to functions which call 'exit'

This commit is contained in:
2025-03-04 11:55:42 +01:00
parent f7cfeb3ad5
commit 9d50e7a584
3 changed files with 7 additions and 8 deletions

4
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"env": { "env": {
"DEBUG": "1", "DEBUG": "1",
"ASAN_OPTIONS": "detect_leaks=0", "ASAN_OPTIONS": "detect_leaks=0",
"UBSAN_OPTIONS": "print_stacktrace=1:halt_on_error=1", "UBSAN_OPTIONS": "print_stacktrace=1:halt_on_error=1"
}, },
"program": "", "program": "",
"linux": { "linux": {
@@ -20,7 +20,7 @@
"preLaunchTask": "(dbg) compile win-x86_64", "preLaunchTask": "(dbg) compile win-x86_64",
"program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}.exe", "program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}.exe",
"cwd": "${workspaceFolder}/bin/win-x86_64/dbg/" "cwd": "${workspaceFolder}/bin/win-x86_64/dbg/"
}, }
} }
] ]
} }

4
.vscode/tasks.json vendored
View File

@@ -4,12 +4,12 @@
{ {
"label": "(dbg) compile linux-x86_64", "label": "(dbg) compile linux-x86_64",
"type": "shell", "type": "shell",
"command": "DEBUG=1 make linux-x86_64", "command": "DEBUG=1 make linux-x86_64"
}, },
{ {
"label": "(dbg) compile win-x86_64", "label": "(dbg) compile win-x86_64",
"type": "shell", "type": "shell",
"command": "DEBUG=1 make win-x86_64", "command": "DEBUG=1 make win-x86_64"
} }
] ]
} }

View File

@@ -1,11 +1,10 @@
#include "error.h" #include "error.h"
#include <SDL_messagebox.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdnoreturn.h>
#include "SDL_messagebox.h"
#define PRINT_BUFFER_SIZE 128 // defines the buffer size for printing #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)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}; char buf[PRINT_BUFFER_SIZE] = {0};
write_args(buf, fmt); write_args(buf, fmt);
(void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf); (void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);