mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Fix error-related issues (#773)
* Mark `error` as a `format` function, to properly scan its format * Fix the call to error() from parser.y: - Use '%s' to avoid passing an arbitrary format - Simplify yyerror overall * Fix size parameter of %.*s format being an int... bonkers standard. * Report the number of arguments required and provided on a STRFMT mismatch * Add an assert to check for a very unlikely bug
This commit is contained in:
@@ -48,7 +48,7 @@ void processWarningFlag(char const *flag);
|
||||
* Used to warn the user about problems that don't prevent the generation of
|
||||
* valid code.
|
||||
*/
|
||||
void warning(enum WarningID id, const char *fmt, ...);
|
||||
void warning(enum WarningID id, const char *fmt, ...) format_(printf, 2, 3);
|
||||
|
||||
/*
|
||||
* Used for errors that compromise the whole assembly process by affecting the
|
||||
@@ -57,7 +57,7 @@ void warning(enum WarningID id, const char *fmt, ...);
|
||||
* 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, ...) format_(printf, 1, 2);
|
||||
|
||||
/*
|
||||
* Used for errors that make it impossible to assemble correctly, but don't
|
||||
@@ -65,6 +65,6 @@ _Noreturn void fatalerror(const char *fmt, ...);
|
||||
* get a list of all errors at the end, making it easier to fix all of them at
|
||||
* once.
|
||||
*/
|
||||
void error(const char *fmt, ...);
|
||||
void error(const char *fmt, ...) format_(printf, 1, 2);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user