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

View File

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

View File

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

View File

@ -118,6 +118,7 @@ type
destructor Destroy; override; destructor Destroy; override;
function IsHintForUnusedUnit(const OutputLine, function IsHintForUnusedUnit(const OutputLine,
MainSrcFile: string): boolean; MainSrcFile: string): boolean;
function IsHintForParameterSenderNotUsed(const OutputLine: string): boolean;
function IsParsing: boolean; function IsParsing: boolean;
procedure ReadLine(const s: string; DontFilterLine: boolean); procedure ReadLine(const s: string; DontFilterLine: boolean);
function ReadFPCompilerLine(const s: string): boolean; function ReadFPCompilerLine(const s: string): boolean;
@ -606,13 +607,17 @@ begin
or CompilerOptions.ShowAll)); or CompilerOptions.ShowAll));
if (not SkipMessage) if (not SkipMessage)
and (CompilerOptions<>nil) and (CompilerOptions<>nil)
and (not CompilerOptions.ShowAll) and (not CompilerOptions.ShowAll) then begin
and (not CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then if (not CompilerOptions.ShowHintsForSenderNotUsed) and
begin (IsHintForParameterSenderNotUsed(s)) then
MainSrcFilename:=CompilerOptions.GetDefaultMainSourceFileName; SkipMessage:=true
if (MainSrcFilename<>'') else if (not CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then
and (IsHintForUnusedUnit(s,MainSrcFilename)) then begin
SkipMessage:=true; MainSrcFilename:=CompilerOptions.GetDefaultMainSourceFileName;
if (MainSrcFilename<>'')
and (IsHintForUnusedUnit(s,MainSrcFilename)) then
SkipMessage:=true;
end;
end; end;
end; end;
@ -811,6 +816,19 @@ begin
Result:=true; Result:=true;
end; 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); procedure TOutputFilter.DoAddFilteredLine(const s: string);
var var
OriginalIndex: Integer; OriginalIndex: Integer;

View File

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