diff --git a/include/asm/main.h b/include/asm/main.h index 77f3e854..49ab7add 100644 --- a/include/asm/main.h +++ b/include/asm/main.h @@ -46,7 +46,7 @@ void opt_Parse(char *s); * It is also used when the assembler goes into an invalid state (for example, * when it fails to allocate memory). */ -noreturn void fatalerror(const char *fmt, ...); +noreturn_ void fatalerror(const char *fmt, ...); /* * Used for errors that make it impossible to assemble correctly, but don't diff --git a/include/extern/err.h b/include/extern/err.h index 291e20a5..7a6e9e50 100644 --- a/include/extern/err.h +++ b/include/extern/err.h @@ -34,10 +34,10 @@ void vwarn(const char *fmt, va_list ap); void warnx(const char *fmt, ...); void vwarnx(const char *fmt, va_list ap); -noreturn void err(int status, const char *fmt, ...); -noreturn void verr(int status, const char *fmt, va_list ap); -noreturn void errx(int status, const char *fmt, ...); -noreturn void verrx(int status, const char *fmt, va_list ap); +noreturn_ void err(int status, const char *fmt, ...); +noreturn_ void verr(int status, const char *fmt, va_list ap); +noreturn_ void errx(int status, const char *fmt, ...); +noreturn_ void verrx(int status, const char *fmt, va_list ap); #endif /* ERR_IN_LIBC */ diff --git a/include/helpers.h b/include/helpers.h index 3a3cc476..3bf43aa0 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -11,10 +11,12 @@ #ifdef __GNUC__ /* GCC or compatible */ - #define noreturn __attribute__ ((noreturn)) + #define noreturn_ __attribute__ ((noreturn)) + #define unused_ __attribute__ ((unused)) #else /* Unsupported, but no need to throw a fit */ - #define noreturn + #define noreturn_ + #define unused_ #endif #endif /* HELPERS_H */ diff --git a/include/link/script.h b/include/link/script.h index 14e9b2f8..7a8663e0 100644 --- a/include/link/script.h +++ b/include/link/script.h @@ -13,7 +13,7 @@ #include "helpers.h" -noreturn void script_fatalerror(const char *fmt, ...); +noreturn_ void script_fatalerror(const char *fmt, ...); void script_Parse(const char *path); diff --git a/src/asm/globlex.c b/src/asm/globlex.c index b25afde0..d03d5b23 100644 --- a/src/asm/globlex.c +++ b/src/asm/globlex.c @@ -20,6 +20,8 @@ #include "asm/symbol.h" #include "asm/symbol.h" +#include "helpers.h" + #include "asmy.h" bool oDontExpandStrings; @@ -219,7 +221,7 @@ uint32_t PutMacroArg(char *src, uint32_t size) return 0; } -uint32_t PutUniqueArg(__attribute ((unused)) char *src, uint32_t size) +uint32_t PutUniqueArg(unused_ char *src, uint32_t size) { char *s; diff --git a/src/asm/symbol.c b/src/asm/symbol.c index 24bcb385..4f9f0c22 100644 --- a/src/asm/symbol.c +++ b/src/asm/symbol.c @@ -25,6 +25,7 @@ #include "extern/err.h" +#include "helpers.h" #include "version.h" struct sSymbol *tHashedSymbols[HASHSIZE]; @@ -62,7 +63,7 @@ void helper_RemoveLeadingZeros(char *string) memmove(string, new_beginning, strlen(new_beginning) + 1); } -int32_t Callback_NARG(__attribute__ ((unused)) struct sSymbol *sym) +int32_t Callback_NARG(unused_ struct sSymbol *sym) { uint32_t i = 0; @@ -72,7 +73,7 @@ int32_t Callback_NARG(__attribute__ ((unused)) struct sSymbol *sym) return i; } -int32_t Callback__LINE__(struct sSymbol __attribute__((unused)) *sym) +int32_t Callback__LINE__(unused_ struct sSymbol *sym) { return nLineNo; } diff --git a/src/extern/err.c b/src/extern/err.c index bcdde402..f1625132 100644 --- a/src/extern/err.c +++ b/src/extern/err.c @@ -33,7 +33,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) { @@ -44,7 +44,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) { @@ -73,7 +73,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; @@ -82,7 +82,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; diff --git a/src/link/lexer.l b/src/link/lexer.l index ac5a4fff..e0f65dc1 100644 --- a/src/link/lexer.l +++ b/src/link/lexer.l @@ -179,7 +179,7 @@ void script_PrintFileStack(void) fprintf(stderr, "%s(%d)", linkerscript_path, include_line[i]); } -noreturn void script_fatalerror(const char *fmt, ...) +noreturn_ void script_fatalerror(const char *fmt, ...) { va_list args; va_start(args, fmt);