Improve helpers.h

Use C11 standard _Noreturn instead of attributes (except, of course, MSVC)
Remove unused helpers
Avoid trapping in release builds, in favor of just unreachability
Improve shim when __builtin_* are not available
This commit is contained in:
ISSOtm
2020-10-26 15:03:37 +01:00
parent 6c57ad2226
commit 0c55703438
10 changed files with 40 additions and 31 deletions

8
src/extern/err.c vendored
View File

@@ -34,7 +34,7 @@ void rgbds_vwarnx(const char *fmt, va_list ap)
putc('\n', stderr);
}
noreturn_ void rgbds_verr(int status, const char *fmt, va_list ap)
_Noreturn void rgbds_verr(int status, const char *fmt, va_list ap)
{
fprintf(stderr, "error: ");
if (fmt) {
@@ -46,7 +46,7 @@ noreturn_ void rgbds_verr(int status, const char *fmt, va_list ap)
exit(status);
}
noreturn_ void rgbds_verrx(int status, const char *fmt, va_list ap)
_Noreturn void rgbds_verrx(int status, const char *fmt, va_list ap)
{
fprintf(stderr, "error");
if (fmt) {
@@ -75,7 +75,7 @@ void rgbds_warnx(const char *fmt, ...)
va_end(ap);
}
noreturn_ void rgbds_err(int status, const char *fmt, ...)
_Noreturn void rgbds_err(int status, const char *fmt, ...)
{
va_list ap;
@@ -84,7 +84,7 @@ noreturn_ void rgbds_err(int status, const char *fmt, ...)
va_end(ap);
}
noreturn_ void rgbds_errx(int status, const char *fmt, ...)
_Noreturn void rgbds_errx(int status, const char *fmt, ...)
{
va_list ap;