From 095807517b6109ec7f6453bf64786c9665fc71f9 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 24 Dec 2019 15:45:32 -0600 Subject: [PATCH] Fix bug leading to spurious errors in some cases when a sym file is present. The issue was that invalid sym files could be generated if an #include is encountered within an #if or #ifdef block in the main source file. The fix (for now) is to simply terminate precompiled header generation if such an #include is encountered. Fixes #2. --- Scanner.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Scanner.pas b/Scanner.pas index 9fe86f3..a7622e2 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -321,6 +321,16 @@ procedure StartInclude (name: gsosOutStringPtr); extern; { file. } { 2. From Header.pas } + +procedure TermHeader; extern; + +{ Stop processing the header file } +{ } +{ Note: This is called when the first code-generating } +{ subroutine is found, and again when the compile ends. It } +{ closes any open symbol file, and should take no action if } +{ called twice. } + {-- Scanner support --------------------------------------------} procedure CheckDelimiters (var name: pString); @@ -1234,6 +1244,9 @@ else fp^.lineNumber := lineNumber+1; if OpenFile(true, default) then begin {open a new file and proceed from there} lineNumber := 1; + if ifList <> nil then + if fp^.next = nil then + TermHeader; StartInclude(@includeFileGS); end {if} else begin {handle a file name error}