From 9471e128b5091838695ab9695b3145d33ac6b22f Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 18 Jan 2024 20:59:46 +0800 Subject: [PATCH] Fixed segname pragmas right after a function definition. --- src/cc65/function.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cc65/function.c b/src/cc65/function.c index 4b4060f2a..d570c2dde 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -685,9 +685,6 @@ void NewFunc (SymEntry* Func, FuncDesc* D) /* Leave the lexical level */ LeaveFunctionLevel (); - /* Eat the closing brace */ - ConsumeRCurly (); - /* Restore the old literal pool, remembering the one for the function */ Func->V.F.LitPool = PopLiteralPool (); @@ -699,6 +696,12 @@ void NewFunc (SymEntry* Func, FuncDesc* D) /* Switch back to the old segments */ PopSegContext (); + /* Eat the closing brace after we've done everything with the function + ** definition. This way we won't have troubles with pragmas right after + ** the closing brace. + */ + ConsumeRCurly(); + /* Reset the current function pointer */ FreeFunction (CurrentFunc); CurrentFunc = 0;