diff --git a/.gitattributes b/.gitattributes index 0ffdd6d02c..fce23bedcb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16702,6 +16702,7 @@ tests/webtbf/tw37476.pp svneol=native#text/pascal tests/webtbf/tw37763.pp svneol=native#text/pascal tests/webtbf/tw3790.pp svneol=native#text/plain tests/webtbf/tw3812.pp svneol=native#text/plain +tests/webtbf/tw38287.pp svneol=native#text/pascal tests/webtbf/tw38289a.pp svneol=native#text/pascal tests/webtbf/tw38289b.pp svneol=native#text/pascal tests/webtbf/tw3930a.pp svneol=native#text/plain diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 947d4d558a..649d2bc75a 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -135,6 +135,8 @@ interface { if nexttoken<>NOTOKEN, then nexttokenpos holds its filepos } next_filepos : tfileposinfo; + { current macro nesting depth } + macro_nesting_depth, comment_level, yylexcount : longint; ignoredirectives : TFPHashList; { ignore directives, used to give warnings only once } @@ -2922,7 +2924,10 @@ type if assigned(inputfile.next) then begin if inputfile.is_macro then - to_dispose:=inputfile + begin + to_dispose:=inputfile; + dec(macro_nesting_depth); + end else begin to_dispose:=nil; @@ -3686,6 +3691,7 @@ type addfile(hp); with inputfile do begin + inc(macro_nesting_depth); setmacro(p,len); { local buffer } inputbuffer:=buf; @@ -4868,7 +4874,7 @@ type mac:=tmacro(search_macro(pattern)); if assigned(mac) and (not mac.is_compiler_var) and (assigned(mac.buftext)) then begin - if yylexcount