Explicitly terminate PCH generation if there is an initialized variable.

Initialized variables have always been one of the things that stops PCH generation, but previously this was only detected when trying to write out the symbol records at the point of a later #include. On a subsequent compile using the sym file, nothing would recognize that PCH generation had stopped for this reason, so the PCH code would recognize the later #include as a potential opportunity to extend the sym file, and therefore would delete it to force regeneration next time. This led to the sym file being deleted and regenerated on alternate compiles, so its full benefit was not realized.

There is code in Header.pas to abort PCH generation if an initialized symbol is found. That is probably superfluous after this change, but it has been left in place for now.
This commit is contained in:
Stephen Heumann 2022-02-19 14:20:58 -06:00
parent aabbadb34b
commit 2a9ec8fc43

View File

@ -3995,6 +3995,7 @@ else {if not isFunction then} begin
variable^.itype^ := tp^;
variable^.itype^.saveDisp := 0;
end;
TermHeader; {make sure the header file is closed}
NextToken; {handle an initializer}
ltypeSpec := typeSpec;
Initializer(variable);