mirror of
https://github.com/thepigeongenerator/sdl_template.git
synced 2025-12-17 05:55:47 +01:00
add noreturn to functions which call 'exit'
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -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/"
|
||||
},
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "error.h"
|
||||
|
||||
#include <SDL_messagebox.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SDL_messagebox.h"
|
||||
#include <stdnoreturn.h>
|
||||
|
||||
#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);
|
||||
|
||||
Reference in New Issue
Block a user