Formatting fixes.
This commit is contained in:
@@ -79,14 +79,14 @@ static Function* NewFunction (struct SymEntry* Sym)
|
|||||||
Function* F = (Function*) xmalloc (sizeof (Function));
|
Function* F = (Function*) xmalloc (sizeof (Function));
|
||||||
|
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
F->FuncEntry = Sym;
|
F->FuncEntry = Sym;
|
||||||
F->ReturnType = GetFuncReturn (Sym->Type);
|
F->ReturnType = GetFuncReturn (Sym->Type);
|
||||||
F->Desc = GetFuncDesc (Sym->Type);
|
F->Desc = GetFuncDesc (Sym->Type);
|
||||||
F->Reserved = 0;
|
F->Reserved = 0;
|
||||||
F->RetLab = GetLocalLabel ();
|
F->RetLab = GetLocalLabel ();
|
||||||
F->TopLevelSP = 0;
|
F->TopLevelSP = 0;
|
||||||
F->RegOffs = RegisterSpace;
|
F->RegOffs = RegisterSpace;
|
||||||
F->Flags = IsTypeVoid (F->ReturnType) ? FF_VOID_RETURN : FF_NONE;
|
F->Flags = IsTypeVoid (F->ReturnType) ? FF_VOID_RETURN : FF_NONE;
|
||||||
|
|
||||||
InitCollection (&F->LocalsBlockStack);
|
InitCollection (&F->LocalsBlockStack);
|
||||||
|
|
||||||
|
|||||||
@@ -272,8 +272,9 @@ static void ParseAutoDecl (Declaration* Decl)
|
|||||||
Sym->Flags |= SC_REF;
|
Sym->Flags |= SC_REF;
|
||||||
|
|
||||||
/* Make note of auto variables initialized in current block.
|
/* Make note of auto variables initialized in current block.
|
||||||
We abuse the Collection somewhat by using it to store line
|
** We abuse the Collection somewhat by using it to store line
|
||||||
numbers. */
|
** numbers.
|
||||||
|
*/
|
||||||
CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(long)GetCurrentLine (),
|
CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(long)GetCurrentLine (),
|
||||||
CollCount (&CurrentFunc->LocalsBlockStack) - 1);
|
CollCount (&CurrentFunc->LocalsBlockStack) - 1);
|
||||||
|
|
||||||
|
|||||||
@@ -537,7 +537,8 @@ static int CompoundStatement (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the segment had autoinited variables, let's pop it of a stack
|
/* If the segment had autoinited variables, let's pop it of a stack
|
||||||
of such blocks. */
|
** of such blocks.
|
||||||
|
*/
|
||||||
if (OldBlockStackSize != CollCount (&CurrentFunc->LocalsBlockStack)) {
|
if (OldBlockStackSize != CollCount (&CurrentFunc->LocalsBlockStack)) {
|
||||||
CollPop (&CurrentFunc->LocalsBlockStack);
|
CollPop (&CurrentFunc->LocalsBlockStack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -697,25 +697,28 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
|
|||||||
NewDOR = AddDefOrRef (Entry, Flags);
|
NewDOR = AddDefOrRef (Entry, Flags);
|
||||||
|
|
||||||
/* Walk through all occurrences of the label so far and evaluate
|
/* Walk through all occurrences of the label so far and evaluate
|
||||||
their relationship with the one passed to the function. */
|
** their relationship with the one passed to the function.
|
||||||
|
*/
|
||||||
for (i = 0; i < CollCount (Entry->V.L.DefsOrRefs); i++) {
|
for (i = 0; i < CollCount (Entry->V.L.DefsOrRefs); i++) {
|
||||||
DOR = CollAt (Entry->V.L.DefsOrRefs, i);
|
DOR = CollAt (Entry->V.L.DefsOrRefs, i);
|
||||||
|
|
||||||
if ((DOR->Flags & SC_DEF) && (Flags & SC_REF) && (Flags & SC_GOTO)) {
|
if ((DOR->Flags & SC_DEF) && (Flags & SC_REF) && (Flags & SC_GOTO)) {
|
||||||
/* We're processing a goto and here is its destination label.
|
/* We're processing a goto and here is its destination label.
|
||||||
This means the difference between SP values is already known,
|
** This means the difference between SP values is already known,
|
||||||
so we simply emit the SP adjustment code. */
|
** so we simply emit the SP adjustment code.
|
||||||
|
*/
|
||||||
if (StackPtr != DOR->StackPtr) {
|
if (StackPtr != DOR->StackPtr) {
|
||||||
g_space (StackPtr - DOR->StackPtr);
|
g_space (StackPtr - DOR->StackPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we jumping into a block with initalization of an object that
|
/* Are we jumping into a block with initalization of an object that
|
||||||
has automatic storage duration? Let's emit a warning. */
|
** has automatic storage duration? Let's emit a warning.
|
||||||
|
*/
|
||||||
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
|
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
|
||||||
(CollCount (AIC) < DOR->Depth ||
|
(CollCount (AIC) < DOR->Depth ||
|
||||||
(long)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
|
(long)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
|
||||||
Warning ("Goto at line %d to label %s jumps into a block with "
|
Warning ("Goto at line %d to label %s jumps into a block with "
|
||||||
"initialization of an object that has automatic storage duration.",
|
"initialization of an object that has automatic storage duration",
|
||||||
GetCurrentLine (), Name);
|
GetCurrentLine (), Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -723,17 +726,19 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
|
|||||||
|
|
||||||
if ((DOR->Flags & SC_REF) && (DOR->Flags & SC_GOTO) && (Flags & SC_DEF)) {
|
if ((DOR->Flags & SC_REF) && (DOR->Flags & SC_GOTO) && (Flags & SC_DEF)) {
|
||||||
/* We're processing a label, let's update all gotos encountered
|
/* We're processing a label, let's update all gotos encountered
|
||||||
so far */
|
** so far
|
||||||
|
*/
|
||||||
g_defdatalabel (DOR->LateSP_Label);
|
g_defdatalabel (DOR->LateSP_Label);
|
||||||
g_defdata (CF_CONST | CF_INT, StackPtr - DOR->StackPtr, 0);
|
g_defdata (CF_CONST | CF_INT, StackPtr - DOR->StackPtr, 0);
|
||||||
|
|
||||||
/* Are we jumping into a block with initalization of an object that
|
/* Are we jumping into a block with initalization of an object that
|
||||||
has automatic storage duration? Let's emit a warning. */
|
** has automatic storage duration? Let's emit a warning.
|
||||||
|
*/
|
||||||
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
|
if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
|
||||||
(CollCount (AIC) >= DOR->Depth ||
|
(CollCount (AIC) >= DOR->Depth ||
|
||||||
(long)CollLast (AIC) >= (long)DOR->Line))
|
(long)CollLast (AIC) >= (long)DOR->Line))
|
||||||
Warning ("Goto at line %d to label %s jumps into a block with "
|
Warning ("Goto at line %d to label %s jumps into a block with "
|
||||||
"initialization of an object that has automatic storage duration.",
|
"initialization of an object that has automatic storage duration",
|
||||||
DOR->Line, Name);
|
DOR->Line, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user