mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-14 16:06:00 +00:00
Fix problem where if a macro's name appeared inside the macro, it would be expanded repeatedly, leading to a crash.
This is a problem introduced by the scanner changes between ORCA/C 2.1.0 and ORCA/C 2.1.1 B3. The following examples demonstrate the problem: #define m m m #define f(x) f(x) f(a)
This commit is contained in:
parent
5c81d970b5
commit
d0b4b75970
@ -1308,7 +1308,7 @@ if macro^.parameters >= 0 then begin {find the values of the parameters}
|
|||||||
if not gettingFileName then {put back the source stream token}
|
if not gettingFileName then {put back the source stream token}
|
||||||
PutBackToken(token, true);
|
PutBackToken(token, true);
|
||||||
Error(12);
|
Error(12);
|
||||||
end;
|
end; {if}
|
||||||
end {if}
|
end {if}
|
||||||
else begin
|
else begin
|
||||||
Error(13);
|
Error(13);
|
||||||
@ -3552,6 +3552,7 @@ var
|
|||||||
expandEnabled: boolean; {can a token be expanded?}
|
expandEnabled: boolean; {can a token be expanded?}
|
||||||
i: 0..maxint; {loop/index counter}
|
i: 0..maxint; {loop/index counter}
|
||||||
inhibit: boolean; {inhibit macro expansion?}
|
inhibit: boolean; {inhibit macro expansion?}
|
||||||
|
lExpandMacros: boolean; {local copy of expandMacros}
|
||||||
lPrintMacroExpansions: boolean; {local copy of printMacroExpansions}
|
lPrintMacroExpansions: boolean; {local copy of printMacroExpansions}
|
||||||
mPtr: macroRecordPtr; {for checking list of macros}
|
mPtr: macroRecordPtr; {for checking list of macros}
|
||||||
setLength: boolean; {is the current string a p-string?}
|
setLength: boolean; {is the current string a p-string?}
|
||||||
@ -3652,7 +3653,10 @@ if tokenList <> nil then begin {get a token put back by a macro}
|
|||||||
token.kind := ident;
|
token.kind := ident;
|
||||||
if token.kind = ident then begin
|
if token.kind = ident then begin
|
||||||
CopyString(@workString, token.name);
|
CopyString(@workString, token.name);
|
||||||
|
lExpandMacros := expandMacros;
|
||||||
|
expandMacros := false;
|
||||||
CheckIdentifier;
|
CheckIdentifier;
|
||||||
|
expandMacros := lExpandMacros;
|
||||||
end; {if}
|
end; {if}
|
||||||
{ dead code
|
{ dead code
|
||||||
if token.kind = ident then
|
if token.kind = ident then
|
||||||
|
Loading…
Reference in New Issue
Block a user