implemented filter for Parameter Sender not used hint

git-svn-id: trunk@8820 -
This commit is contained in:
vincents 2006-02-24 22:04:54 +00:00
parent e9c7038930
commit 066083b1f6
5 changed files with 49 additions and 8 deletions

View File

@ -1089,6 +1089,7 @@ begin
ShowNothing := XMLConfigFile.GetValue(p+'Verbosity/ShowNothing/Value', false);
ShowSummary := XMLConfigFile.GetValue(p+'Verbosity/ShowSummary/Value', false);
ShowHintsForUnusedUnitsInMainSrc := XMLConfigFile.GetValue(p+'Verbosity/ShowHintsForUnusedUnitsInMainSrc/Value', false);
ShowHintsForSenderNotUsed := XMLConfigFile.GetValue(p+'Verbosity/ShowHintsForSenderNotUsed/Value', false);
WriteFPCLogo := XMLConfigFile.GetValue(p+'WriteFPCLogo/Value', true);
StopAfterErrCount := XMLConfigFile.GetValue(p+'ConfigFile/StopAfterErrCount/Value', 1);
@ -1239,6 +1240,7 @@ begin
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowNothing/Value', ShowNothing,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowSummary/Value', ShowSummary,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowHintsForUnusedUnitsInMainSrc/Value', ShowHintsForUnusedUnitsInMainSrc,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowHintsForSenderNotUsed/Value', ShowHintsForSenderNotUsed,false);
XMLConfigFile.SetDeleteValue(p+'WriteFPCLogo/Value', WriteFPCLogo,true);
XMLConfigFile.SetDeleteValue(p+'ConfigFile/StopAfterErrCount/Value', StopAfterErrCount,1);
@ -2266,6 +2268,7 @@ begin
fShowNothing := false;
fShowSummary := false;
fShowHintsForUnusedUnitsInMainSrc := false;
fShowHintsForSenderNotUsed := false;
fWriteFPCLogo := true;
fStopAfterErrCount := 1;
@ -2371,6 +2374,7 @@ begin
fShowNothing := CompOpts.fShowNothing;
fShowSummary := CompOpts.FShowSummary;
fShowHintsForUnusedUnitsInMainSrc := CompOpts.fShowHintsForUnusedUnitsInMainSrc;
fShowHintsForSenderNotUsed := CompOpts.fShowHintsForSenderNotUsed;
fWriteFPCLogo := CompOpts.fWriteFPCLogo;
fStopAfterErrCount := CompOpts.fStopAfterErrCount;
@ -2466,6 +2470,7 @@ begin
and (fShowNothing = CompOpts.fShowNothing)
and (fShowSummary = CompOpts.fShowSummary)
and (fShowHintsForUnusedUnitsInMainSrc = CompOpts.fShowHintsForUnusedUnitsInMainSrc)
and (fShowHintsForSenderNotUsed = CompOpts.fShowHintsForSenderNotUsed)
and (fWriteFPCLogo = CompOpts.fWriteFPCLogo)
// other

View File

@ -174,6 +174,7 @@ type
chkExecutableInfo: TCheckBox;
chkNothing: TCheckBox;
chkHintsForUnusedUnitsInMainSrc: TCheckBox;
chkHintsForSenderNotUsed: TCheckBox;
chkFPCLogo: TCheckBox;
grpErrorCnt: TGroupBox;
@ -730,6 +731,7 @@ begin
chkShowSummary.Checked := Options.ShowSummary;
chkHintsForUnusedUnitsInMainSrc.Checked :=
Options.ShowHintsForUnusedUnitsInMainSrc;
chkHintsForSenderNotUsed.Checked := Options.ShowHintsForSenderNotUsed;
chkFPCLogo.Checked := Options.WriteFPCLogo;
@ -997,6 +999,7 @@ begin
Options.ShowSummary := chkShowSummary.Checked;
Options.ShowHintsForUnusedUnitsInMainSrc :=
chkHintsForUnusedUnitsInMainSrc.Checked;
Options.ShowHintsForSenderNotUsed := chkHintsForSenderNotUsed.Checked;
Options.WriteFPCLogo := chkFPCLogo.Checked;
@ -1880,7 +1883,7 @@ begin
Parent := MsgPage;
Top := 10;
Left := 10;
Height := 235;
Height := 256;
Width := Self.ClientWidth-28;
Caption := dlgVerbosity;
end;
@ -2092,6 +2095,17 @@ begin
Width := chkDebugInfo.Width*2;
end;
chkHintsForSenderNotUsed := TCheckBox.Create(Self);
with chkHintsForSenderNotUsed do
begin
Parent := grpVerbosity;
Caption := dlgHintsParameterSenderNotUsed+' (none)';
Top := 216;
Left := ChkErrors.Left;
Height := ChkErrors.Height;
Width := chkDebugInfo.Width*2;
end;
{------------------------------------------------------------}
grpErrorCnt := TGroupBox.Create(Self);
with grpErrorCnt do

View File

@ -1066,6 +1066,7 @@ resourcestring
dlgShowNothing = 'Show nothing (only errors)';
dlgWriteFPCLogo = 'Write an FPC logo';
dlgHintsUnused = 'Show Hints for unused units in main source';
dlgHintsParameterSenderNotUsed = 'Show Hints for parameter "Sender" not used';
dlgConfigFiles = 'Config Files:';
dlgUseFpcCfg = 'Use standard Compiler Config File (fpc.cfg)';
dlgUseCustomConfig = 'Use addional Compiler Config File';

View File

@ -118,6 +118,7 @@ type
destructor Destroy; override;
function IsHintForUnusedUnit(const OutputLine,
MainSrcFile: string): boolean;
function IsHintForParameterSenderNotUsed(const OutputLine: string): boolean;
function IsParsing: boolean;
procedure ReadLine(const s: string; DontFilterLine: boolean);
function ReadFPCompilerLine(const s: string): boolean;
@ -606,13 +607,17 @@ begin
or CompilerOptions.ShowAll));
if (not SkipMessage)
and (CompilerOptions<>nil)
and (not CompilerOptions.ShowAll)
and (not CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then
begin
MainSrcFilename:=CompilerOptions.GetDefaultMainSourceFileName;
if (MainSrcFilename<>'')
and (IsHintForUnusedUnit(s,MainSrcFilename)) then
SkipMessage:=true;
and (not CompilerOptions.ShowAll) then begin
if (not CompilerOptions.ShowHintsForSenderNotUsed) and
(IsHintForParameterSenderNotUsed(s)) then
SkipMessage:=true
else if (not CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then
begin
MainSrcFilename:=CompilerOptions.GetDefaultMainSourceFileName;
if (MainSrcFilename<>'')
and (IsHintForUnusedUnit(s,MainSrcFilename)) then
SkipMessage:=true;
end;
end;
end;
@ -811,6 +816,19 @@ begin
Result:=true;
end;
function TOutputFilter.IsHintForParameterSenderNotUsed(const OutputLine: string): boolean;
{ recognizes hints of the form
Unit1.pas(15,28) Hint: Parameter "Sender" not used
}
const
SenderNotUsed= ') Hint: Parameter "Sender" not used';
begin
Result:=
pos(SenderNotUsed, OutputLine)=Length(OutputLine)-Length(SenderNotUsed)+1;
end;
procedure TOutputFilter.DoAddFilteredLine(const s: string);
var
OriginalIndex: Integer;

View File

@ -139,6 +139,7 @@ type
fShowNothing: Boolean;
fShowSummary: Boolean;
fShowHintsForUnusedUnitsInMainSrc: Boolean;
fShowHintsForSenderNotUsed: Boolean;
fWriteFPCLogo: Boolean;
fStopAfterErrCount: integer;
@ -251,6 +252,8 @@ type
property ShowSummary: Boolean read FShowSummary write FShowSummary;
property ShowHintsForUnusedUnitsInMainSrc: Boolean
read fShowHintsForUnusedUnitsInMainSrc write fShowHintsForUnusedUnitsInMainSrc;
property ShowHintsForSenderNotUsed: Boolean
read fShowHintsForSenderNotUsed write fShowHintsForSenderNotUsed;
property WriteFPCLogo: Boolean read fWriteFPCLogo write fWriteFPCLogo;
property StopAfterErrCount: integer
read fStopAfterErrCount write fStopAfterErrCount;