From b233984952d80ad0847f80a81cc6cb054fb7e2bc Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 17 Feb 2015 13:20:27 +0000 Subject: [PATCH] IDE: compare compiled file: ignore spaces between options git-svn-id: trunk@47861 - --- ide/compileroptions.pp | 13 +++++++++---- packager/packagesystem.pas | 35 +++++++++++++++++------------------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 168e490301..496dde2e49 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -647,6 +647,7 @@ function ParseString(Options: TParsedCompilerOptions; const UnparsedValue: string; PlatformIndependent: boolean): string; function GetMakefileMacroValue(const MacroName: string): string; +function TargetNeedsFPCOptionCG(TargetOS, TargetCPU: string): boolean; procedure GatherInheritedOptions(AddOptionsList: TFPList; Parsed: TCompilerOptionsParseType; @@ -714,6 +715,13 @@ begin Result:=''; end; +function TargetNeedsFPCOptionCG(TargetOS, TargetCPU: string): boolean; +begin + Result:= (TargetCPU='x86_64') + and ((TargetOS='linux') or (TargetOS='freebsd') or (TargetOS='netbsd') + or (TargetOS='openbsd') or (TargetOS='solaris')); +end; + procedure GatherInheritedOptions(AddOptionsList: TFPList; Parsed: TCompilerOptionsParseType; var InheritedOptionStrings: TInheritedCompOptsStrings); @@ -2812,10 +2820,7 @@ begin if RelocatableUnit and (CurSrcOS='win') then switches := switches + ' -WR'; if (not (ccloNoMacroParams in Flags)) - and (CurTargetCPU='x86_64') - and ((CurTargetOS='linux') or (CurTargetOS='freebsd') or (CurTargetOS='netbsd') - or (CurTargetOS='openbsd') or (CurTargetOS='solaris')) - then + and TargetNeedsFPCOptionCG(CurTargetOS,CurTargetCPU) then switches := switches + ' -Cg'; // see bug 17412 { Checks } diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index f07b15cc81..a4769818ae 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -533,39 +533,40 @@ var begin Result:=TStringList.Create; - Reduced:=CompParams; + Reduced:=''; AllPaths:=Result; EndPos:=1; - while ReadNextFPCParameter(Reduced,EndPos,StartPos) do begin - if (Reduced[StartPos]='-') and (StartPos'') and (Path[1] in ['''','"']) then Path:=AnsiDequotedStr(Path,Path[1]); case Reduced[StartPos+2] of - 'u': AddSearchPath('UnitPath'); - 'U': AllPaths.Values['UnitOutputDir']:=Path; - 'i': AddSearchPath('IncPath'); - 'o': AddSearchPath('ObjectPath'); - 'l': AddSearchPath('LibPath'); - else continue; + 'u': begin AddSearchPath('UnitPath'); continue; end; + 'U': begin AllPaths.Values['UnitOutputDir']:=Path; continue; end; + 'i': begin AddSearchPath('IncPath'); continue; end; + 'o': begin AddSearchPath('ObjectPath'); continue; end; + 'l': begin AddSearchPath('LibPath'); continue; end; end; - DeleteOption; end; 'v': // verbosity - DeleteOption; + continue; 'i','l': // information - DeleteOption; + continue; 'B': // build clean - DeleteOption; + continue; end; end; + if Reduced<>'' then + Reduced+=' '; + Reduced+=copy(CompParams,StartPos,EndPos-StartPos); end; if BaseDir<>'' then begin for i:=0 to AllPaths.Count-1 do begin @@ -2970,8 +2971,6 @@ begin stats^.CompilerFilename:=StringReplace(stats^.CompilerFilename,'%(','$(',[rfReplaceAll]); stats^.Params:=StringReplace(stats^.Params,'%(','$(',[rfReplaceAll]); end; - end; - if stats^.ViaMakefile then begin ForcePathDelims(stats^.CompilerFilename); ForcePathDelims(stats^.Params); end;