From: uz Date: Sun, 21 Aug 2011 16:23:38 +0000 (+0000) Subject: Fix a problem with macro expansion count in line infos for macros. X-Git-Tag: V2.13.3~215 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ae98f4bcd8d4963661d45eb320d9d75a1578dd9e;p=cc65 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 --- diff --git a/src/ca65/macro.c b/src/ca65/macro.c index c9715578d..99c6acce7 100644 --- a/src/ca65/macro.c +++ b/src/ca65/macro.c @@ -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;