mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 06:30:16 +00:00
Fixed Issue #1028 by outputing local literals when exiting the function scope.
This commit is contained in:
parent
68f53e69f1
commit
07a5324a81
@ -453,7 +453,7 @@ void FinishCompile (void)
|
||||
}
|
||||
|
||||
/* Output the literal pool */
|
||||
OutputLiteralPool ();
|
||||
OutputGlobalLiteralPool ();
|
||||
|
||||
/* Emit debug infos if enabled */
|
||||
EmitDebugInfo ();
|
||||
|
@ -582,6 +582,11 @@ void NewFunc (SymEntry* Func)
|
||||
/* Restore the old literal pool, remembering the one for the function */
|
||||
Func->V.F.LitPool = PopLiteralPool ();
|
||||
|
||||
/* If --local-strings was given, output the literals now */
|
||||
if (IS_Get (&LocalStrings)) {
|
||||
OutputLocalLiteralPool (Func->V.F.LitPool);
|
||||
}
|
||||
|
||||
/* Switch back to the old segments */
|
||||
PopSegments ();
|
||||
|
||||
|
@ -147,18 +147,6 @@ Literal* UseLiteral (Literal* L)
|
||||
/* Increase the reference count */
|
||||
++L->RefCount;
|
||||
|
||||
/* If --local-strings was given, immediately output the literal */
|
||||
if (IS_Get (&LocalStrings)) {
|
||||
/* Switch to the proper data segment */
|
||||
if (IS_Get (&WritableStrings)) {
|
||||
g_usedata ();
|
||||
} else {
|
||||
g_userodata ();
|
||||
}
|
||||
/* Output the literal */
|
||||
OutputLiteral (L);
|
||||
}
|
||||
|
||||
/* Return the literal */
|
||||
return L;
|
||||
}
|
||||
@ -454,12 +442,20 @@ static void OutputReadOnlyLiterals (Collection* Literals)
|
||||
|
||||
|
||||
|
||||
void OutputLiteralPool (void)
|
||||
/* Output the global literal pool */
|
||||
void OutputLocalLiteralPool (LiteralPool* Pool)
|
||||
/* Output the local literal pool */
|
||||
{
|
||||
/* Output both sorts of literals */
|
||||
OutputWritableLiterals (&GlobalPool->WritableLiterals);
|
||||
OutputReadOnlyLiterals (&GlobalPool->ReadOnlyLiterals);
|
||||
OutputWritableLiterals (&Pool->WritableLiterals);
|
||||
OutputReadOnlyLiterals (&Pool->ReadOnlyLiterals);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OutputGlobalLiteralPool (void)
|
||||
/* Output the global literal pool */
|
||||
{
|
||||
OutputLocalLiteralPool (GlobalPool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,8 +113,11 @@ void MoveLiteralPool (LiteralPool* LocalPool);
|
||||
** function will free LocalPool after moving the used string literals.
|
||||
*/
|
||||
|
||||
void OutputLiteralPool (void);
|
||||
/* Output the literal pool */
|
||||
void OutputLocalLiteralPool (LiteralPool* Pool);
|
||||
/* Output the local literal pool */
|
||||
|
||||
void OutputGlobalLiteralPool (void);
|
||||
/* Output the global literal pool */
|
||||
|
||||
Literal* AddLiteral (const char* S);
|
||||
/* Add a literal string to the literal pool. Return the literal. */
|
||||
|
Loading…
Reference in New Issue
Block a user