1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

Fix a problem with macro expansion count in line infos for macros.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5247 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-08-21 16:23:38 +00:00
parent 6cdac5eb4c
commit ae98f4bcd8

View File

@ -126,6 +126,7 @@ struct MacExp {
unsigned IfSP; /* .IF stack pointer at start of expansion */
TokNode* Exp; /* Pointer to current token */
TokNode* Final; /* Pointer to final token */
unsigned MacExpansions; /* Number of active macro expansions */
unsigned LocalStart; /* Start of counter for local symbol names */
unsigned ParamCount; /* Number of actual parameters */
TokNode** Params; /* List of actual parameters */
@ -295,26 +296,24 @@ static MacExp* NewMacExp (Macro* M)
MacExp* E = xmalloc (sizeof (MacExp));
/* Initialize the data */
E->M = M;
E->IfSP = GetIfStack ();
E->Exp = M->TokRoot;
E->Final = 0;
E->LocalStart = LocalName;
LocalName += M->LocalCount;
E->ParamCount = 0;
E->Params = xmalloc (M->ParamCount * sizeof (TokNode*));
E->M = M;
E->IfSP = GetIfStack ();
E->Exp = M->TokRoot;
E->Final = 0;
E->MacExpansions = ++MacExpansions; /* One macro expansion more */
E->LocalStart = LocalName;
LocalName += M->LocalCount;
E->ParamCount = 0;
E->Params = xmalloc (M->ParamCount * sizeof (TokNode*));
for (I = 0; I < M->ParamCount; ++I) {
E->Params[I] = 0;
}
E->ParamExp = 0;
E->LI = 0;
E->ParamExp = 0;
E->LI = 0;
/* Mark the macro as expanding */
++M->Expansions;
/* One macro expansion more */
++MacExpansions;
/* Return the new macro expansion */
return E;
}
@ -668,7 +667,7 @@ ExpandParam:
if (Mac->LI) {
EndLine (Mac->LI);
}
Mac->LI = StartLine (&CurTok.Pos, LI_TYPE_MACRO, MacExpansions);
Mac->LI = StartLine (&CurTok.Pos, LI_TYPE_MACRO, Mac->MacExpansions);
/* Set pointer to next token */
Mac->Exp = Mac->Exp->Next;