IDE: compiler options -vm: check fpc error message file if msg id exists

git-svn-id: trunk@46915 -
This commit is contained in:
mattias 2014-11-20 23:21:50 +00:00
parent 649a39e0f8
commit 22a782c356

View File

@ -407,7 +407,7 @@ type
function Equals(Obj: TObject): boolean; override; function Equals(Obj: TObject): boolean; override;
procedure IncreaseChangeStamp; procedure IncreaseChangeStamp;
function GetEnumerator: TCompilerMsgIDFlagsEnumerator; function GetEnumerator: TCompilerMsgIDFlagsEnumerator;
function GetMsgIdList(Delim: char; aValue: TCompilerFlagValue): string; function GetMsgIdList(Delim: char; aValue: TCompilerFlagValue; FPCMsgFile: TFPCMsgFilePoolItem = nil): string;
function CreateDiff(Tool: TCompilerDiffTool; Other: TCompilerMsgIDFlags): boolean; function CreateDiff(Tool: TCompilerDiffTool; Other: TCompilerMsgIDFlags): boolean;
function Count: SizeInt; inline; function Count: SizeInt; inline;
property ChangeStamp: int64 read FChangeStamp; property ChangeStamp: int64 read FChangeStamp;
@ -2483,6 +2483,7 @@ var
DefaultTargetCPU: string; DefaultTargetCPU: string;
FPCompilerFilename: String; FPCompilerFilename: String;
s: string; s: string;
FPCMsgFile: TFPCMsgFilePoolItem;
begin begin
CurMainSrcFile:=MainSourceFileName; CurMainSrcFile:=MainSourceFileName;
if CurMainSrcFile='' then if CurMainSrcFile='' then
@ -2980,12 +2981,20 @@ begin
switches := switches + ' ' + tempsw; switches := switches + ' ' + tempsw;
end; end;
t := IDEMessageFlags.GetMsgIdList(',',cfvHide); // -vm flags allow to enable/disable types of messages
if t <> '' then // Passing a -vm ID, unknown by the current compiler will create an error
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t); // => check the compiler message file
t := IDEMessageFlags.GetMsgIdList(',',cfvShow); if IDEMessageFlags.Count>0 then begin
if t <> '' then FPCMsgFile:=nil;
switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t); if FPCMsgFilePool<>nil then
FPCMsgFile:=FPCMsgFilePool.LoadCurrentEnglishFile(true,nil);
t := IDEMessageFlags.GetMsgIdList(',',cfvHide,FPCMsgFile);
if t <> '' then
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
t := IDEMessageFlags.GetMsgIdList(',',cfvShow,FPCMsgFile);
if t <> '' then
switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t);
end;
if (StopAfterErrCount>1) then if (StopAfterErrCount>1) then
switches := switches + ' -Se'+IntToStr(StopAfterErrCount); switches := switches + ' -Se'+IntToStr(StopAfterErrCount);
@ -4674,13 +4683,14 @@ begin
end; end;
function TCompilerMsgIDFlags.GetMsgIdList(Delim: char; function TCompilerMsgIDFlags.GetMsgIdList(Delim: char;
aValue: TCompilerFlagValue): string; aValue: TCompilerFlagValue; FPCMsgFile: TFPCMsgFilePoolItem): string;
var var
Flag: PCompilerMsgIdFlag; Flag: PCompilerMsgIdFlag;
begin begin
Result:=''; Result:='';
for Flag in Self do begin for Flag in Self do begin
if Flag^.Flag<>aValue then continue; if Flag^.Flag<>aValue then continue;
if (FPCMsgFile<>nil) and (FPCMsgFile.GetMsg(Flag^.MsgId)=nil) then continue;
if Result<>'' then if Result<>'' then
Result+=Delim; Result+=Delim;
Result+=IntToStr(Flag^.MsgId); Result+=IntToStr(Flag^.MsgId);