Record the cc= string in the symbol file and require it to match.
Macros and include paths from the cc= parameters may be included in the symbol file, so incorrect behavior could result if the symbol file was used for a later compilation with different cc= parameters.
This commit is contained in:
parent
06e17cd8f5
commit
913a333f9f
33
Header.pas
33
Header.pas
|
@ -18,7 +18,7 @@ uses CCommon, MM, Scanner, Symbol, CGI;
|
|||
{$segment 'SCANNER'}
|
||||
|
||||
const
|
||||
symFileVersion = 19; {version number of .sym file format}
|
||||
symFileVersion = 21; {version number of .sym file format}
|
||||
|
||||
var
|
||||
inhibitHeader: boolean; {should .sym includes be blocked?}
|
||||
|
@ -1253,6 +1253,7 @@ var
|
|||
symRefnum := opRec.refnum;
|
||||
OpenSymbols := true;
|
||||
WriteWord(symFileVersion);
|
||||
WriteLongString(pointer(@infoStringGS.theString));
|
||||
tokenMark := GetMark;
|
||||
includeMark := false;
|
||||
end; {if}
|
||||
|
@ -1876,15 +1877,31 @@ var
|
|||
end; {OpenSymbolFile}
|
||||
|
||||
|
||||
function SymbolVersion: integer;
|
||||
function SymbolFileIsUsable: boolean;
|
||||
|
||||
{ Read the symbol file version number }
|
||||
{ Read the symbol file header to check if it is usable }
|
||||
{ }
|
||||
{ Returns: version number }
|
||||
{ Returns: True if the symbol file is usable, false if not }
|
||||
|
||||
begin {SymbolVersion}
|
||||
SymbolVersion := ReadWord;
|
||||
end; {SymbolVersion}
|
||||
label 1;
|
||||
|
||||
var
|
||||
ccPtr: longStringPtr; {cc= string recorded in symbol file}
|
||||
i: integer; {loop counter}
|
||||
|
||||
begin {SymbolFileIsUsable}
|
||||
SymbolFileIsUsable := false;
|
||||
if ReadWord = symFileVersion then begin
|
||||
ccPtr := ReadLongString;
|
||||
if ccPtr^.length = infoStringGS.theString.size then begin
|
||||
for i := 1 to infoStringGS.theString.size do
|
||||
if ccPtr^.str[i] <> infoStringGS.theString.theString[i] then
|
||||
goto 1;
|
||||
SymbolFileIsUsable := true;
|
||||
end; {if}
|
||||
end; {if}
|
||||
1:
|
||||
end; {SymbolFileIsUsable}
|
||||
|
||||
|
||||
function SourceMatches: boolean;
|
||||
|
@ -1938,7 +1955,7 @@ if not ignoreSymbols then begin
|
|||
includeLevel := 0; {no nested includes}
|
||||
symChPtr := chPtr; {record initial source location}
|
||||
if OpenSymbolFile(fName) then begin {check for symbol file}
|
||||
if SymbolVersion = symFileVersion then begin
|
||||
if SymbolFileIsUsable then begin
|
||||
done := EndOfSymbols; {valid file found - process it}
|
||||
if done then
|
||||
PurgeSymbols;
|
||||
|
|
2
cc.notes
2
cc.notes
|
@ -1748,6 +1748,8 @@ int foo(int[42]);
|
|||
|
||||
178. Keep names specified via the KEEP= portion of the command line or the {KeepName} shell variable could sometimes be saved in the .sym file and applied to subsequent compilations, even if they were no longer specified for the later compilation. Also, if a .sym file was used, the keep name specified via #pragma keep might override the one specified on the command line or via {KeepName}.
|
||||
|
||||
179. Macro definitions or header search paths specified via the cc= portion of the command line could be saved in the .sym file and applied to subsequent compilations, even if they were no longer specified on the command line.
|
||||
|
||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||
|
||||
1. In some situations, fread() reread the first 1K or so of the file.
|
||||
|
|
Loading…
Reference in New Issue