1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +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 */ /* Pointer to current function */
Function* CurrentFunc = 0; Function* CurrentFunc = 0;
@ -523,7 +524,7 @@ void NewFunc (SymEntry* Func)
/* Need a starting curly brace */ /* Need a starting curly brace */
ConsumeLCurly (); ConsumeLCurly ();
CollAppend (&CurrentFunc->LocalsBlockStack, (void *)CurrentFunc->LocalsBlockCount); CollAppend (&CurrentFunc->LocalsBlockStack, 0);
/* Parse local variable declarations if any */ /* Parse local variable declarations if any */
DeclareLocals (); DeclareLocals ();

View File

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

View File

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

View File

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

View File

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