1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00

Minor changes after review.

This commit is contained in:
Laubzega 2018-09-21 21:10:58 -07:00 committed by Oliver Schmidt
parent f5b3c5351e
commit a4b6bb63c0
5 changed files with 7 additions and 9 deletions

View File

@ -60,6 +60,7 @@
/*****************************************************************************/
/* Pointer to current function */
Function* CurrentFunc = 0;
@ -523,7 +524,7 @@ void NewFunc (SymEntry* Func)
/* Need a starting curly brace */
ConsumeLCurly ();
CollAppend (&CurrentFunc->LocalsBlockStack, (void *)CurrentFunc->LocalsBlockCount);
CollAppend (&CurrentFunc->LocalsBlockStack, 0);
/* Parse local variable declarations if any */
DeclareLocals ();

View File

@ -65,8 +65,6 @@ struct Function {
Collection LocalsBlockStack; /* Stack of blocks with local vars */
};
/* Structure that holds all data needed for function activation */
typedef struct Function Function;

View File

@ -538,8 +538,7 @@ void DeclareLocals (void)
/* Be sure to allocate any reserved space for locals */
F_AllocLocalSpace (CurrentFunc);
if (InitialStack != StackPtr)
{
if (InitialStack != StackPtr) {
++CurrentFunc->LocalsBlockCount;
/* Is it ok to abuse Collection in this way? */
CollAppend (&CurrentFunc->LocalsBlockStack, (void *)CurrentFunc->LocalsBlockCount);

View File

@ -535,8 +535,9 @@ static int CompoundStatement (void)
g_space (StackPtr - OldStack);
}
if (OldStack != StackPtr)
if (OldStack != StackPtr) {
CollPop (&CurrentFunc->LocalsBlockStack);
}
StackPtr = OldStack;

View File

@ -100,18 +100,17 @@ struct LiteralPool;
/* Symbol table entry */
/* Label definition or reference */
typedef struct DefOrRef DefOrRef;
struct DefOrRef {
unsigned Line;
long LocalsBlockNum;
unsigned Flags;
};
/* Symbol table entry */
typedef struct SymEntry SymEntry;
struct SymEntry {
SymEntry* NextHash; /* Next entry in hash list */
SymEntry* PrevSym; /* Previous symbol in dl list */