mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +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:
@@ -746,7 +746,7 @@ static void beginExpansion(size_t distance, uint8_t skip,
|
||||
#define LOOKUP_PRE_NEST(exp) (exp)->totalLen += size - skip
|
||||
#define LOOKUP_POST_NEST(exp) do { \
|
||||
if (name && ++depth >= nMaxRecursionDepth) \
|
||||
fatalerror("Recursion limit (%u) exceeded\n", nMaxRecursionDepth); \
|
||||
fatalerror("Recursion limit (%zu) exceeded\n", nMaxRecursionDepth); \
|
||||
} while (0)
|
||||
lookupExpansion(parent, distance);
|
||||
#undef LOOKUP_PRE_NEST
|
||||
@@ -851,7 +851,7 @@ static int peekInternal(uint8_t distance)
|
||||
assert(writeIndex + (size) <= LEXER_BUF_SIZE); \
|
||||
nbCharsRead = read(lexerState->fd, &lexerState->buf[writeIndex], (size)); \
|
||||
if (nbCharsRead == -1) \
|
||||
fatalerror("Error while reading \"%s\": %s\n", lexerState->path, errno); \
|
||||
fatalerror("Error while reading \"%s\": %s\n", lexerState->path, strerror(errno)); \
|
||||
totalCharsRead += nbCharsRead; \
|
||||
writeIndex += nbCharsRead; \
|
||||
if (writeIndex == LEXER_BUF_SIZE) \
|
||||
|
||||
Reference in New Issue
Block a user