diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 20635d3df2..61e29c79e3 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -34,6 +34,7 @@ interface widestr,cpuinfo; const + max_include_nesting=32; max_macro_nesting=16; maxmacrolen=16*1024; preprocbufsize=32*1024; @@ -83,6 +84,7 @@ interface tscannerfile = class public inputfile : tinputfile; { current inputfile list } + inputfilecount : longint; inputbuffer, { input buffer } inputpointer : pchar; @@ -759,26 +761,32 @@ implementation if (not found) then found:=findincludefile(path,name,target_info.pasext,foundfile); end; - { save old postion and decrease linebreak } - if c=newline then - dec(current_scanner.line_no); - dec(longint(current_scanner.inputpointer)); - { shutdown current file } - current_scanner.tempcloseinputfile; - { load new file } - hp:=do_openinputfile(foundfile); - current_scanner.addfile(hp); - current_module.sourcefiles.register_file(hp); - if not current_scanner.openinputfile then - Message1(scan_f_cannot_open_includefile,hs); - Message1(scan_t_start_include_file,current_scanner.inputfile.path^+current_scanner.inputfile.name^); - current_scanner.reload; - { process first read char } - case c of - #26 : current_scanner.reload; - #10, - #13 : current_scanner.linebreak; - end; + if current_scanner.inputfilecount