#include "standard.h"
#include "symtab.h"
#include "typeconv.h"
+#include "input.h"
/* Mark the variable as referenced */
Sym->Flags |= SC_REF;
+ /* Make note of auto variables initialized in current block.
+ ** We abuse the Collection somewhat by using it to store line
+ ** numbers.
+ */
+ CollReplace (&CurrentFunc->LocalsBlockStack,
+ (void *)(size_t)GetCurrentLine (),
+ CollCount (&CurrentFunc->LocalsBlockStack) - 1);
+
} else {
/* Non-initialized local variable. Just keep track of
** the space needed.
/* Remember the current stack pointer */
int InitialStack = StackPtr;
+ /* A place to store info about potential initializations of auto variables */
+ CollAppend (&CurrentFunc->LocalsBlockStack, 0);
+
/* Loop until we don't find any more variables */
while (1) {
/* Be sure to allocate any reserved space for locals */
F_AllocLocalSpace (CurrentFunc);
+ /* No auto variables were inited. No new block on the stack then. */
+ if (CollLast (&CurrentFunc->LocalsBlockStack) == NULL) {
+ CollPop (&CurrentFunc->LocalsBlockStack);
+ }
+
/* In case we've allocated local variables in this block, emit a call to
** the stack checking routine if stack checks are enabled.
*/