|
@@ -135,6 +135,8 @@ interface
|
|
{ if nexttoken<>NOTOKEN, then nexttokenpos holds its filepos }
|
|
{ if nexttoken<>NOTOKEN, then nexttokenpos holds its filepos }
|
|
next_filepos : tfileposinfo;
|
|
next_filepos : tfileposinfo;
|
|
|
|
|
|
|
|
+ { current macro nesting depth }
|
|
|
|
+ macro_nesting_depth,
|
|
comment_level,
|
|
comment_level,
|
|
yylexcount : longint;
|
|
yylexcount : longint;
|
|
ignoredirectives : TFPHashList; { ignore directives, used to give warnings only once }
|
|
ignoredirectives : TFPHashList; { ignore directives, used to give warnings only once }
|
|
@@ -2922,7 +2924,10 @@ type
|
|
if assigned(inputfile.next) then
|
|
if assigned(inputfile.next) then
|
|
begin
|
|
begin
|
|
if inputfile.is_macro then
|
|
if inputfile.is_macro then
|
|
- to_dispose:=inputfile
|
|
|
|
|
|
+ begin
|
|
|
|
+ to_dispose:=inputfile;
|
|
|
|
+ dec(macro_nesting_depth);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
to_dispose:=nil;
|
|
to_dispose:=nil;
|
|
@@ -3686,6 +3691,7 @@ type
|
|
addfile(hp);
|
|
addfile(hp);
|
|
with inputfile do
|
|
with inputfile do
|
|
begin
|
|
begin
|
|
|
|
+ inc(macro_nesting_depth);
|
|
setmacro(p,len);
|
|
setmacro(p,len);
|
|
{ local buffer }
|
|
{ local buffer }
|
|
inputbuffer:=buf;
|
|
inputbuffer:=buf;
|
|
@@ -4868,7 +4874,7 @@ type
|
|
mac:=tmacro(search_macro(pattern));
|
|
mac:=tmacro(search_macro(pattern));
|
|
if assigned(mac) and (not mac.is_compiler_var) and (assigned(mac.buftext)) then
|
|
if assigned(mac) and (not mac.is_compiler_var) and (assigned(mac.buftext)) then
|
|
begin
|
|
begin
|
|
- if yylexcount<max_macro_nesting then
|
|
|
|
|
|
+ if (yylexcount<max_macro_nesting) and (macro_nesting_depth<max_macro_nesting) then
|
|
begin
|
|
begin
|
|
mac.is_used:=true;
|
|
mac.is_used:=true;
|
|
inc(yylexcount);
|
|
inc(yylexcount);
|