mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +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:
parent
6cdac5eb4c
commit
ae98f4bcd8
@ -126,6 +126,7 @@ struct MacExp {
|
|||||||
unsigned IfSP; /* .IF stack pointer at start of expansion */
|
unsigned IfSP; /* .IF stack pointer at start of expansion */
|
||||||
TokNode* Exp; /* Pointer to current token */
|
TokNode* Exp; /* Pointer to current token */
|
||||||
TokNode* Final; /* Pointer to final token */
|
TokNode* Final; /* Pointer to final token */
|
||||||
|
unsigned MacExpansions; /* Number of active macro expansions */
|
||||||
unsigned LocalStart; /* Start of counter for local symbol names */
|
unsigned LocalStart; /* Start of counter for local symbol names */
|
||||||
unsigned ParamCount; /* Number of actual parameters */
|
unsigned ParamCount; /* Number of actual parameters */
|
||||||
TokNode** Params; /* List of actual parameters */
|
TokNode** Params; /* List of actual parameters */
|
||||||
@ -295,26 +296,24 @@ static MacExp* NewMacExp (Macro* M)
|
|||||||
MacExp* E = xmalloc (sizeof (MacExp));
|
MacExp* E = xmalloc (sizeof (MacExp));
|
||||||
|
|
||||||
/* Initialize the data */
|
/* Initialize the data */
|
||||||
E->M = M;
|
E->M = M;
|
||||||
E->IfSP = GetIfStack ();
|
E->IfSP = GetIfStack ();
|
||||||
E->Exp = M->TokRoot;
|
E->Exp = M->TokRoot;
|
||||||
E->Final = 0;
|
E->Final = 0;
|
||||||
E->LocalStart = LocalName;
|
E->MacExpansions = ++MacExpansions; /* One macro expansion more */
|
||||||
LocalName += M->LocalCount;
|
E->LocalStart = LocalName;
|
||||||
E->ParamCount = 0;
|
LocalName += M->LocalCount;
|
||||||
E->Params = xmalloc (M->ParamCount * sizeof (TokNode*));
|
E->ParamCount = 0;
|
||||||
|
E->Params = xmalloc (M->ParamCount * sizeof (TokNode*));
|
||||||
for (I = 0; I < M->ParamCount; ++I) {
|
for (I = 0; I < M->ParamCount; ++I) {
|
||||||
E->Params[I] = 0;
|
E->Params[I] = 0;
|
||||||
}
|
}
|
||||||
E->ParamExp = 0;
|
E->ParamExp = 0;
|
||||||
E->LI = 0;
|
E->LI = 0;
|
||||||
|
|
||||||
/* Mark the macro as expanding */
|
/* Mark the macro as expanding */
|
||||||
++M->Expansions;
|
++M->Expansions;
|
||||||
|
|
||||||
/* One macro expansion more */
|
|
||||||
++MacExpansions;
|
|
||||||
|
|
||||||
/* Return the new macro expansion */
|
/* Return the new macro expansion */
|
||||||
return E;
|
return E;
|
||||||
}
|
}
|
||||||
@ -668,7 +667,7 @@ ExpandParam:
|
|||||||
if (Mac->LI) {
|
if (Mac->LI) {
|
||||||
EndLine (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 */
|
/* Set pointer to next token */
|
||||||
Mac->Exp = Mac->Exp->Next;
|
Mac->Exp = Mac->Exp->Next;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user