X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Ffunction.c;h=8944d10077583c722124f0b19c75a8c5cf5f0921;hb=112ae0e3db511ddd92e769c11328646ebe2a6240;hp=09f44d39c3e52b04283c9931f4c4509fb73cc290;hpb=a5a9700d19350aa985532e53d67766f80f81d300;p=cc65 diff --git a/src/cc65/function.c b/src/cc65/function.c index 09f44d39c..8944d1007 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -359,7 +359,7 @@ static void F_RestoreRegVars (Function* F) } - + /*****************************************************************************/ /* code */ /*****************************************************************************/ @@ -380,9 +380,9 @@ void NewFunc (SymEntry* Func) /* Reenter the lexical level */ ReenterFunctionLevel (D); - /* Check if the function header contains unnamed parameters. These are + /* Check if the function header contains unnamed parameters. These are * only allowed in cc65 mode. - */ + */ if ((D->Flags & FD_UNNAMED_PARAMS) != 0 && (IS_Get (&Standard) != STD_CC65)) { Error ("Parameter name omitted"); } @@ -439,6 +439,9 @@ void NewFunc (SymEntry* Func) /* Allocate code and data segments for this function */ Func->V.F.Seg = PushSegments (Func); + /* Allocate a new literal pool */ + PushLiteralPool (Func); + /* If this is a fastcall function, push the last parameter onto the stack */ if (IsQualFastcall (Func->Type) && D->ParamCount > 0) { @@ -539,6 +542,9 @@ void NewFunc (SymEntry* Func) /* Eat the closing brace */ ConsumeRCurly (); + /* Restore the old literal pool, remembering the one for the function */ + Func->V.F.LitPool = PopLiteralPool (); + /* Switch back to the old segments */ PopSegments ();