Better handling of a warning like ISPPBuiltins.iss missing.

This commit is contained in:
Martijn Laan 2020-08-09 02:22:48 +02:00
parent caf329694f
commit e01e53f6fd

View File

@ -93,7 +93,7 @@ type
procedure PopFile; procedure PopFile;
function CheckFile(const FileName: string): Boolean; function CheckFile(const FileName: string): Boolean;
function EmitDestination: TStringList; function EmitDestination: TStringList;
procedure SendMsg(const Msg: string; Typ: TIsppMessageType); procedure SendMsg(Msg: string; Typ: TIsppMessageType);
protected protected
function GetDefaultScope: TDefineScope; function GetDefaultScope: TDefineScope;
procedure SetDefaultScope(Scope: TDefineScope); procedure SetDefaultScope(Scope: TDefineScope);
@ -1134,18 +1134,25 @@ begin
SendMsg(Format(Msg, Args), imtWarning); SendMsg(Format(Msg, Args), imtWarning);
end; end;
procedure TPreprocessor.SendMsg(const Msg: string; Typ: TIsppMessageType); procedure TPreprocessor.SendMsg(Msg: string; Typ: TIsppMessageType);
const const
MsgPrefixes: array[TIsppMessageType] of string = ('', 'Warning: '); MsgPrefixes: array[TIsppMessageType] of string = ('', 'Warning: ');
var var
S: string; LineNumber: Word;
FileName: String;
begin begin
S := GetFileName(-1); Msg := Format('%s%s', [MsgPrefixes[Typ], Msg]);
if S <> '' then
S := Format('Line %d of %s: %s%s', [GetLineNumber(-1), PathExtractName(S), MsgPrefixes[Typ], Msg]) LineNumber := GetLineNumber(-1);
else if LineNumber <> 0 then begin
S := Format('Line %d: %s%s', [GetLineNumber(-1), MsgPrefixes[Typ], Msg]); FileName := GetFileName(-1);
FCompilerParams.StatusProc(FCompilerParams.CompilerData, PChar(S), Typ = imtWarning); if FileName <> '' then
Msg := Format('Line %d of %s: %s', [LineNumber, PathExtractName(FileName), Msg])
else
Msg := Format('Line %d: %s', [LineNumber, Msg]);
end;
FCompilerParams.StatusProc(FCompilerParams.CompilerData, PChar(Msg), Typ = imtWarning);
end; end;
function TPreprocessor.DimOf(const Name: String): Integer; function TPreprocessor.DimOf(const Name: String): Integer;