mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
rgbasm -r sets the maximum recursion depth (#1026)
Previously it set the minimum failure depth (off by one) Fixes #978
This commit is contained in:
@@ -37,7 +37,6 @@ struct Context {
|
||||
|
||||
static struct Context *contextStack;
|
||||
static size_t contextDepth = 0;
|
||||
#define DEFAULT_MAX_DEPTH 64
|
||||
size_t maxRecursionDepth;
|
||||
|
||||
static unsigned int nbIncPaths = 0;
|
||||
@@ -510,7 +509,7 @@ bool fstk_Break(void)
|
||||
|
||||
void fstk_NewRecursionDepth(size_t newDepth)
|
||||
{
|
||||
if (contextDepth >= newDepth)
|
||||
if (contextDepth > newDepth)
|
||||
fatalerror("Recursion limit (%zu) exceeded\n", newDepth);
|
||||
maxRecursionDepth = newDepth;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ void lexer_CheckRecursionDepth(void)
|
||||
size_t depth = 0;
|
||||
|
||||
for (struct Expansion *exp = lexerState->expansions; exp; exp = exp->parent) {
|
||||
if (depth++ >= maxRecursionDepth)
|
||||
if (depth++ > maxRecursionDepth)
|
||||
fatalerror("Recursion limit (%zu) exceeded\n", maxRecursionDepth);
|
||||
}
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ static int readIdentifier(char firstChar)
|
||||
|
||||
static char const *readInterpolation(size_t depth)
|
||||
{
|
||||
if (depth >= maxRecursionDepth)
|
||||
if (depth > maxRecursionDepth)
|
||||
fatalerror("Recursion limit (%zu) exceeded\n", maxRecursionDepth);
|
||||
|
||||
char symName[MAXSYMLEN + 1];
|
||||
|
||||
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
|
||||
verbose = false;
|
||||
warnings = true;
|
||||
sym_SetExportAll(false);
|
||||
uint32_t maxDepth = 64;
|
||||
uint32_t maxDepth = DEFAULT_MAX_DEPTH;
|
||||
size_t targetFileNameLen = 0;
|
||||
|
||||
while ((ch = musl_getopt_long_only(argc, argv, optstring, longopts, NULL)) != -1) {
|
||||
|
||||
Reference in New Issue
Block a user