From: Laubzega Date: Sat, 22 Sep 2018 04:10:58 +0000 (-0700) Subject: Minor changes after review. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a4b6bb63c093b0947995ae67fa34910cf8151166;p=cc65 Minor changes after review. --- diff --git a/src/cc65/function.c b/src/cc65/function.c index eb2ad4bcd..96b3d6c75 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -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 (); diff --git a/src/cc65/function.h b/src/cc65/function.h index 1b04009d6..5c5822045 100644 --- a/src/cc65/function.h +++ b/src/cc65/function.h @@ -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; diff --git a/src/cc65/locals.c b/src/cc65/locals.c index a231a6003..20d370c46 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -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); diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index be58e4a7e..b766ec044 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -535,8 +535,9 @@ static int CompoundStatement (void) g_space (StackPtr - OldStack); } - if (OldStack != StackPtr) + if (OldStack != StackPtr) { CollPop (&CurrentFunc->LocalsBlockStack); + } StackPtr = OldStack; diff --git a/src/cc65/symentry.h b/src/cc65/symentry.h index 2c22f99a0..24b647234 100644 --- a/src/cc65/symentry.h +++ b/src/cc65/symentry.h @@ -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 */