IDE: fpc msg parser: use relative Compiling paths

git-svn-id: trunk@45144 -
This commit is contained in:
mattias 2014-05-21 22:25:21 +00:00
parent 772e4d235b
commit 164c12f8ca
3 changed files with 19 additions and 4 deletions

View File

@ -267,6 +267,9 @@ type
{ TFPCParser - standard parser for Free Pascal messages, implemented by IDE }
TFPCParser = class(TExtToolParser)
private
FHideHintsSenderNotUsed: boolean;
FHideHintsUnitNotUsedInMainSource: boolean;
protected
FFilesToIgnoreUnitNotUsed: TStrings;
public
@ -277,6 +280,11 @@ type
class function GetFPCMsgValues(Msg: TMessageLine; out Value1, Value2: string): boolean; virtual; abstract;
property FilesToIgnoreUnitNotUsed: TStrings read FFilesToIgnoreUnitNotUsed
write FFilesToIgnoreUnitNotUsed;
property HideHintsSenderNotUsed: boolean read FHideHintsSenderNotUsed
write FHideHintsSenderNotUsed default true;
property HideHintsUnitNotUsedInMainSource: boolean
read FHideHintsUnitNotUsedInMainSource
write FHideHintsUnitNotUsedInMainSource default true;
end;
{ TMakeParser - standard parser for 'make' messages, implemented by IDE }

View File

@ -1028,6 +1028,8 @@ begin
inc(p,2); // skip ./
AFilename:=ExtractFilePath(TrimFilename(p));
if AFilename<>'' then begin
if (not FilenameIsAbsolute(AFilename)) and (Tool.WorkerDirectory<>'') then
AFilename:=TrimFilename(AppendPathDelim(Tool.WorkerDirectory)+AFilename);
if DirectoryStack=nil then DirectoryStack:=TStringList.Create;
if (DirectoryStack.Count=0)
or (DirectoryStack[DirectoryStack.Count-1]<>AFilename) then
@ -1504,8 +1506,8 @@ procedure TIDEFPCParser.ImproveMsgSenderNotUsed(MsgLine: TMessageLine);
begin
if (MsgLine.Urgency<=mluVerbose) then exit;
// check for Sender not used
if (MsgLine.Msg='Parameter "Sender" not used') then begin
// almost always not important
if HideHintsSenderNotUsed
and (MsgLine.Msg='Parameter "Sender" not used') then begin
MsgLine.Urgency:=mluVerbose;
end;
end;
@ -1526,7 +1528,8 @@ begin
if IndexInStringList(FilesToIgnoreUnitNotUsed,cstFilename,aFilename)>=0 then
begin
MsgLine.Urgency:=mluVerbose;
end else if FilenameIsAbsolute(aFilename)
end else if HideHintsUnitNotUsedInMainSource
and FilenameIsAbsolute(aFilename)
and ((CompareFileExt(aFilename, 'lpr', false)=0)
or FileExists(ChangeFileExt(aFilename, '.lpk'), aSynchronized))
then begin
@ -1794,6 +1797,8 @@ begin
fLineToMsgID:=TPatternToMsgIDs.Create;
fFileExists:=TFilenameToPointerTree.Create(false);
FFilesToIgnoreUnitNotUsed:=TStringList.Create;
HideHintsSenderNotUsed:=true;
HideHintsUnitNotUsedInMainSource:=true;
end;
function TIDEFPCParser.FileExists(const Filename: string; aSynchronized: boolean

View File

@ -3522,8 +3522,10 @@ begin
{$IFDEF EnableNewExtTools}
PkgCompileTool:=ExternalToolList.Add(Format(lisPkgMangCompilingPackage, [APackage.IDAsString]));
FPCParser:=TFPCParser(PkgCompileTool.AddParsers(SubToolFPC));
if APackage.MainUnit<>nil then
if (APackage.MainUnit<>nil)
and (APackage.CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then
FPCParser.FilesToIgnoreUnitNotUsed.Add(APackage.MainUnit.Filename);
FPCParser.HideHintsSenderNotUsed:=not APackage.CompilerOptions.ShowHintsForSenderNotUsed;
PkgCompileTool.AddParsers(SubToolMake);
PkgCompileTool.Process.CurrentDirectory:=APackage.Directory;
PkgCompileTool.Process.Executable:=CompilerFilename;