mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 18:36:10 +02:00
codetools: fixed rebuilding nodes when targetcpu changed
git-svn-id: branches/fixes_1_4@48288 -
This commit is contained in:
parent
f15ba59e59
commit
4d846084c4
@ -568,7 +568,7 @@ type
|
||||
function CreateFPCTemplate(const CompilerPath, CompilerOptions,
|
||||
TestPascalFile: string;
|
||||
out UnitSearchPath, TargetOS,
|
||||
TargetProcessor: string;
|
||||
aTargetCPU: string;
|
||||
Owner: TObject): TDefineTemplate;
|
||||
function GetFPCVerFromFPCTemplate(Template: TDefineTemplate;
|
||||
out FPCVersion, FPCRelease, FPCPatch: integer): boolean;
|
||||
@ -1994,15 +1994,15 @@ begin
|
||||
ctsDefaultFPCSource2OperatingSystem,
|
||||
ExternalMacroStart+'SrcOS2',SrcOS2,da_DefineRecurse);
|
||||
Result.AddChild(NewDefTempl);
|
||||
// define #TargetProcessor
|
||||
// define #TargetCPU
|
||||
TargetCPU:=Config.RealTargetCPU;
|
||||
if TargetCPU='' then
|
||||
TargetCPU:=Config.TargetCPU;
|
||||
if TargetCPU='' then
|
||||
TargetCPU:=GetCompiledTargetCPU;
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetProcessor',
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetCPU',
|
||||
ctsDefaultFPCTargetProcessor,
|
||||
ExternalMacroStart+'TargetProcessor',TargetCPU,
|
||||
TargetCPUMacroName,TargetCPU,
|
||||
da_DefineRecurse);
|
||||
Result.AddChild(NewDefTempl);
|
||||
|
||||
@ -2043,7 +2043,7 @@ end;
|
||||
function CreateFPCSourceTemplate(FPCSrcDir: string; Owner: TObject
|
||||
): TDefineTemplate;
|
||||
var
|
||||
Dir, SrcOS, SrcOS2, TargetProcessor,
|
||||
Dir, SrcOS, SrcOS2, aTargetCPU,
|
||||
IncPathMacro: string;
|
||||
DS: char; // dir separator
|
||||
|
||||
@ -2072,8 +2072,8 @@ var
|
||||
IncludePathMacroName,IncPathMacro+';inc',
|
||||
da_Define));
|
||||
RTLSrcOSDir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
'include path to TargetProcessor directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetProcessor,
|
||||
'include path to TargetCPU directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+aTargetCPU,
|
||||
da_Define));
|
||||
ParentDefTempl.AddChild(IfTargetOSIsNotSrcOS);
|
||||
|
||||
@ -2086,8 +2086,8 @@ var
|
||||
SrcOS2,da_Directory);
|
||||
IfTargetOSIsNotSrcOS2.AddChild(RTLSrcOS2Dir);
|
||||
RTLSrcOS2Dir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
'include path to TargetProcessor directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetProcessor,
|
||||
'include path to TargetCPU directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+aTargetCPU,
|
||||
da_DefineRecurse));
|
||||
ParentDefTempl.AddChild(IfTargetOSIsNotSrcOS2);
|
||||
end;
|
||||
@ -2126,8 +2126,8 @@ begin
|
||||
Dir:=AppendPathDelim(FPCSrcDir);
|
||||
SrcOS:='$('+ExternalMacroStart+'SrcOS)';
|
||||
SrcOS2:='$('+ExternalMacroStart+'SrcOS2)';
|
||||
TargetProcessor:='$('+ExternalMacroStart+'TargetProcessor)';
|
||||
IncPathMacro:='$('+ExternalMacroStart+'IncPath)';
|
||||
aTargetCPU:=TargetCPUMacro;
|
||||
IncPathMacro:=IncludePathMacro;
|
||||
|
||||
Result:=TDefineTemplate.Create(StdDefTemplFPCSrc,
|
||||
Format(ctsFreePascalSourcesPlusDesc,['RTL, FCL, Packages, Compiler']),
|
||||
@ -2162,12 +2162,12 @@ begin
|
||||
+';'+Dir+'rtl'+DS+SrcOS+DS
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS
|
||||
+';'+Dir+'rtl'+DS+SrcOS2+DS
|
||||
+';'+Dir+'rtl'+DS+SrcOS2+DS+TargetProcessor
|
||||
+';'+Dir+'rtl'+DS+TargetProcessor+DS
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS+TargetProcessor+DS;
|
||||
+';'+Dir+'rtl'+DS+SrcOS2+DS+aTargetCPU
|
||||
+';'+Dir+'rtl'+DS+aTargetCPU+DS
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS+aTargetCPU+DS;
|
||||
RTLDir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
Format(ctsIncludeDirectoriesPlusDirs,
|
||||
['objpas, inc,'+TargetProcessor+','+SrcOS]),
|
||||
['objpas, inc,'+aTargetCPU+','+SrcOS]),
|
||||
IncludePathMacroName,s,da_DefineRecurse));
|
||||
|
||||
// if solaris or darwin or beos then define FPC_USE_LIBC
|
||||
@ -2212,16 +2212,16 @@ begin
|
||||
TargetOSMacro,da_Directory);
|
||||
s:=IncPathMacro
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS+SrcOS+'inc' // e.g. rtl/win32/inc/
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS+TargetProcessor+DS
|
||||
+';'+Dir+'rtl'+DS+TargetOSMacro+DS+aTargetCPU+DS
|
||||
;
|
||||
RTLOSDir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
Format(ctsIncludeDirectoriesPlusDirs,[TargetProcessor]),
|
||||
Format(ctsIncludeDirectoriesPlusDirs,[aTargetCPU]),
|
||||
IncludePathMacroName,
|
||||
s,da_DefineRecurse));
|
||||
s:=SrcPathMacro
|
||||
+';'+Dir+'rtl'+DS+'objpas'+DS;
|
||||
RTLOSDir.AddChild(TDefineTemplate.Create('Src Path',
|
||||
Format(ctsAddsDirToSourcePath,[TargetProcessor]),
|
||||
Format(ctsAddsDirToSourcePath,[aTargetCPU]),
|
||||
ExternalMacroStart+'SrcPath',s,da_DefineRecurse));
|
||||
RTLDir.AddChild(RTLOSDir);
|
||||
|
||||
@ -2411,7 +2411,7 @@ begin
|
||||
da_Directory);
|
||||
CompilerDir.AddChild(TDefineTemplate.Create('SrcPath','SrcPath addition',
|
||||
ExternalMacroStart+'SrcPath',
|
||||
SrcPathMacro+';'+Dir+TargetProcessor,da_Define));
|
||||
SrcPathMacro+';'+Dir+aTargetCPU,da_Define));
|
||||
CompilerDir.AddChild(TDefineTemplate.Create('IncPath','IncPath addition',
|
||||
IncludePathMacroName,
|
||||
IncPathMacro+';'+Dir+'compiler',da_DefineRecurse));
|
||||
@ -5090,7 +5090,7 @@ end;
|
||||
|
||||
function TDefinePool.CreateFPCTemplate(
|
||||
const CompilerPath, CompilerOptions, TestPascalFile: string;
|
||||
out UnitSearchPath, TargetOS, TargetProcessor: string;
|
||||
out UnitSearchPath, TargetOS, aTargetCPU: string;
|
||||
Owner: TObject): TDefineTemplate;
|
||||
// create symbol definitions for the freepascal compiler
|
||||
// To get reliable values the compiler itself is asked for
|
||||
@ -5228,7 +5228,7 @@ begin
|
||||
UnitSearchPath:='';
|
||||
TargetOS:='';
|
||||
SrcOS:='';
|
||||
TargetProcessor:='';
|
||||
aTargetCPU:='';
|
||||
if (CompilerPath='') or (not FileIsExecutable(CompilerPath)) then exit;
|
||||
LastDefTempl:=nil;
|
||||
// find all initial compiler macros and all unit paths
|
||||
@ -5352,10 +5352,10 @@ begin
|
||||
i:=1;
|
||||
while i<=OutLen do begin
|
||||
if Buf[i] in [#10,#13] then begin
|
||||
TargetProcessor:=copy(Buf,1,i-1);
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetProcessor',
|
||||
aTargetCPU:=copy(Buf,1,i-1);
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetCPU',
|
||||
ctsDefaultFPCTargetProcessor,
|
||||
ExternalMacroStart+'TargetProcessor',TargetProcessor,
|
||||
TargetCPUMacroName,aTargetCPU,
|
||||
da_DefineRecurse);
|
||||
AddTemplate(NewDefTempl);
|
||||
break;
|
||||
@ -5466,7 +5466,7 @@ function TDefinePool.CreateFPCSrcTemplate(
|
||||
UnitLinkListValid: boolean; var UnitLinkList: string;
|
||||
Owner: TObject): TDefineTemplate;
|
||||
var
|
||||
Dir, SrcOS, SrcOS2, TargetProcessor, UnitLinks: string;
|
||||
Dir, SrcOS, SrcOS2, TargetCPU, UnitLinks: string;
|
||||
UnitTree: TAVLTree; // tree of TDefTemplUnitNameLink
|
||||
IncPathMacro, DefaultSrcOS, DefaultSrcOS2: string;
|
||||
ProgressID: integer;
|
||||
@ -5584,7 +5584,7 @@ var
|
||||
// replace processor type
|
||||
for i:=Low(FPCProcessorNames) to High(FPCProcessorNames) do
|
||||
if ReplaceDir(FPCProcessorNames[i],DefaultProcessorName,
|
||||
TargetProcessor)
|
||||
TargetCPU)
|
||||
then
|
||||
break;
|
||||
end;
|
||||
@ -5949,8 +5949,8 @@ var
|
||||
IncludePathMacroName,IncPathMacro+';inc',
|
||||
da_Define));
|
||||
RTLSrcOSDir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
'include path to TargetProcessor directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetProcessor,
|
||||
'include path to TargetCPU directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetCPU,
|
||||
da_Define));
|
||||
ParentDefTempl.AddChild(IfTargetOSIsNotSrcOS);
|
||||
|
||||
@ -5963,8 +5963,8 @@ var
|
||||
SrcOS2,da_Directory);
|
||||
IfTargetOSIsNotSrcOS2.AddChild(RTLSrcOS2Dir);
|
||||
RTLSrcOS2Dir.AddChild(TDefineTemplate.Create('Include Path',
|
||||
'include path to TargetProcessor directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetProcessor,
|
||||
'include path to TargetCPU directories',
|
||||
IncludePathMacroName,IncPathMacro+';'+TargetCPU,
|
||||
da_DefineRecurse));
|
||||
ParentDefTempl.AddChild(IfTargetOSIsNotSrcOS2);
|
||||
end;
|
||||
@ -5986,8 +5986,8 @@ begin
|
||||
Dir:=AppendPathDelim(FPCSrcDir);
|
||||
SrcOS:='$('+ExternalMacroStart+'SrcOS)';
|
||||
SrcOS2:='$('+ExternalMacroStart+'SrcOS2)';
|
||||
TargetProcessor:='$('+ExternalMacroStart+'TargetProcessor)';
|
||||
IncPathMacro:='$('+ExternalMacroStart+'IncPath)';
|
||||
TargetCPU:=TargetCPUMacro;
|
||||
IncPathMacro:=IncludePathMacro;
|
||||
DefaultSrcOS:=GetDefaultSrcOSForTargetOS(DefaultTargetOS);
|
||||
DefaultSrcOS2:=GetDefaultSrcOS2ForTargetOS(DefaultTargetOS);
|
||||
|
||||
|
@ -1992,9 +1992,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TExpressionEvaluator.WriteDebugReport;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
DebugLn('[TExpressionEvaluator.WriteDebugReport] ');
|
||||
ConsistencyCheck;
|
||||
for i:=0 to Count-1 do
|
||||
debugln(' ',Items(i));
|
||||
end;
|
||||
|
||||
function TExpressionEvaluator.CalcMemSize(WithNamesAndValues: boolean;
|
||||
|
@ -2236,7 +2236,7 @@ begin
|
||||
|
||||
// check initvalues
|
||||
//if ExtractFileNameOnly(MainFilename)='androidr14' then
|
||||
// debugln(['TLinkScanner.UpdateNeeded FGlobalInitValuesChangeStep=',FGlobalInitValuesChangeStep,' CurInitValuesChangeStep=',CurInitValuesChangeStep]);
|
||||
//debugln(['TLinkScanner.UpdateNeeded FGlobalInitValuesChangeStep=',FGlobalInitValuesChangeStep,' CurInitValuesChangeStep=',CurInitValuesChangeStep]);
|
||||
if FGlobalInitValuesChangeStep<>CurInitValuesChangeStep then begin
|
||||
FGlobalInitValuesChangeStep:=CurInitValuesChangeStep;
|
||||
if Assigned(FOnGetInitValues) then begin
|
||||
|
@ -42,7 +42,7 @@ uses
|
||||
{$IFDEF MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeTree, CodeAtom,
|
||||
Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeTree, CodeAtom, ExprEval,
|
||||
CustomCodeTool, MultiKeyWordListTool, KeywordFuncLists, BasicCodeTools,
|
||||
CodeToolsStructs, LinkScanner, CodeCache, AVL_Tree;
|
||||
|
||||
@ -140,6 +140,9 @@ type
|
||||
// parsing
|
||||
FLastCompilerMode: TCompilerMode;
|
||||
FLastCompilerModeSwitches: TCompilerModeSwitches;
|
||||
FLastDefineStatic: Boolean;
|
||||
FLastDefineEmbedded: Boolean;
|
||||
FLastDefineTargetCPU: String;
|
||||
procedure FetchScannerSource(Range: TLinkScannerRange); override;
|
||||
// sections
|
||||
function KeyWordFuncSection: boolean;
|
||||
@ -513,6 +516,7 @@ end;
|
||||
function TPascalParserTool.EndOfSourceExpected: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
//debugln(['TPascalParserTool.EndOfSourceExpected ',MainFilename,' Atom=',GetAtom,' ',CleanPosToStr(CurPos.StartPos,true)]);
|
||||
SaveRaiseEndOfSourceExpected;
|
||||
end;
|
||||
|
||||
@ -598,7 +602,8 @@ begin
|
||||
CurNode:=Tree.Root;
|
||||
if CurNode<>nil then
|
||||
while CurNode.NextBrother<>nil do CurNode:=CurNode.NextBrother;
|
||||
//debugln(['TPascalParserTool.BuildTree CurNode=',CurNode.DescAsString]);
|
||||
//if (ExtractFileNameOnly(MainFilename)='androidr14') and (CurNode<>nil) then
|
||||
//debugln(['TPascalParserTool.BuildTree CurNode=',CurNode.DescAsString]);
|
||||
if (CurNode=nil)
|
||||
or ((CurNode.Desc in AllSourceTypes) and (CurNode.FirstChild=nil)) then begin
|
||||
// parse source from the beginning
|
||||
@ -782,7 +787,8 @@ begin
|
||||
|
||||
ReadNextAtom;
|
||||
{$IFDEF VerboseUpdateNeeded}
|
||||
debugln(['TPascalParserTool.BuildTree ScannedRange=',dbgs(ScannedRange),' CurNode=',CurNode.DescAsString,' first atom=',GetAtom,' Range=',dbgs(Range)]);
|
||||
//if ExtractFileNameOnly(MainFilename)='androidr14' then
|
||||
debugln(['TPascalParserTool.BuildTree ScannedRange=',dbgs(ScannedRange),' CurNode=',CurNode.DescAsString,' first atom=',GetAtom,' Range=',dbgs(Range)]);
|
||||
{$ENDIF}
|
||||
|
||||
if (CurNode.Desc in (AllSourceTypes+[ctnInterface]))
|
||||
@ -5144,6 +5150,9 @@ var
|
||||
DiffPos: PtrInt;
|
||||
Node: TCodeTreeNode;
|
||||
DeleteNode: TCodeTreeNode;
|
||||
aHasStatic: Boolean;
|
||||
aHasEmbedded: Boolean;
|
||||
aTargetCPU: String;
|
||||
begin
|
||||
// update scanned code
|
||||
if FLastScannerChangeStep=Scanner.ChangeStep then begin
|
||||
@ -5155,10 +5164,23 @@ begin
|
||||
// code has changed
|
||||
//debugln(['TPascalParserTool.FetchScannerSource link scanner has changed ',MainFilename]);
|
||||
FLastScannerChangeStep:=Scanner.ChangeStep;
|
||||
aHasStatic:=Scanner.Values.IsDefined('STATIC');
|
||||
aHasEmbedded:=Scanner.Values.IsDefined('EMBEDDED');
|
||||
aTargetCPU:=Scanner.Values[ExternalMacroStart+'TargetCPU'];
|
||||
AllChanged:=(FLastCompilerMode<>Scanner.CompilerMode)
|
||||
or (FLastCompilerModeSwitches<>Scanner.CompilerModeSwitches);
|
||||
or (FLastCompilerModeSwitches<>Scanner.CompilerModeSwitches)
|
||||
or (FLastDefineStatic<>aHasStatic)
|
||||
or (FLastDefineEmbedded<>aHasEmbedded)
|
||||
or (FLastDefineTargetCPU<>aTargetCPU);
|
||||
//if ExtractFileNameOnly(MainFilename)='androidr14' then begin
|
||||
//Scanner.Values.WriteDebugReport;
|
||||
//debugln(['TPascalParserTool.FetchScannerSource ',aTargetCPU,' old=',FLastDefineTargetCPU]);
|
||||
//end;
|
||||
FLastCompilerMode:=Scanner.CompilerMode;
|
||||
FLastCompilerModeSwitches:=Scanner.CompilerModeSwitches;
|
||||
FLastDefineStatic:=aHasStatic;
|
||||
FLastDefineEmbedded:=aHasEmbedded;
|
||||
FLastDefineTargetCPU:=aTargetCPU;
|
||||
NewSrc:=Scanner.CleanedSrc;
|
||||
NewSrcLen:=length(NewSrc);
|
||||
if AllChanged then begin
|
||||
|
Loading…
Reference in New Issue
Block a user