mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Avoid using VLA in EQUS dumping
MSVC does not support those... Also add a `develop` warning about VLAs, to avoid future incidents
This commit is contained in:
@@ -897,11 +897,14 @@ void lexer_DumpStringExpansions(void)
|
||||
{
|
||||
if (!lexerState)
|
||||
return;
|
||||
struct Expansion *stack[nMaxRecursionDepth + 1];
|
||||
struct Expansion **stack = malloc(sizeof(*stack) * (nMaxRecursionDepth + 1));
|
||||
struct Expansion *expansion; /* Temp var for `lookupExpansion` */
|
||||
unsigned int depth = 0;
|
||||
size_t distance = lexerState->expansionOfs;
|
||||
|
||||
if (!stack)
|
||||
fatalerror("Failed to alloc string expansion stack: %s\n", strerror(errno));
|
||||
|
||||
#define LOOKUP_PRE_NEST(exp) do { \
|
||||
/* Only register EQUS expansions, not string args */ \
|
||||
if ((exp)->name) \
|
||||
@@ -915,6 +918,7 @@ void lexer_DumpStringExpansions(void)
|
||||
|
||||
while (depth--)
|
||||
fprintf(stderr, "while expanding symbol \"%s\"\n", stack[depth]->name);
|
||||
free(stack);
|
||||
}
|
||||
|
||||
/* Function to discard all of a line's comments */
|
||||
|
||||
Reference in New Issue
Block a user