mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 20:47:09 +01:00
MG: showing linker errors
git-svn-id: trunk@1657 -
This commit is contained in:
parent
194546760e
commit
cb4486355e
@ -48,6 +48,7 @@ type
|
|||||||
private
|
private
|
||||||
fCurrentDirectory: string;
|
fCurrentDirectory: string;
|
||||||
fFilteredOutput: TStringList;
|
fFilteredOutput: TStringList;
|
||||||
|
fOutput: TStringList;
|
||||||
fLastErrorType: TErrorType;
|
fLastErrorType: TErrorType;
|
||||||
fLastMessageType: TOutputMessageType;
|
fLastMessageType: TOutputMessageType;
|
||||||
fCompilingHistory: TStringList;
|
fCompilingHistory: TStringList;
|
||||||
@ -58,6 +59,7 @@ type
|
|||||||
fProject: TProject;
|
fProject: TProject;
|
||||||
fPrgSourceFilename: string;
|
fPrgSourceFilename: string;
|
||||||
procedure DoAddFilteredLine(const s: string);
|
procedure DoAddFilteredLine(const s: string);
|
||||||
|
procedure DoAddLastLinkerMessages;
|
||||||
function SearchIncludeFile(const ShortIncFilename: string): string;
|
function SearchIncludeFile(const ShortIncFilename: string): string;
|
||||||
public
|
public
|
||||||
procedure Execute(TheProcess: TProcess);
|
procedure Execute(TheProcess: TProcess);
|
||||||
@ -74,6 +76,7 @@ type
|
|||||||
function ReadMakeLine(const s: string): boolean;
|
function ReadMakeLine(const s: string): boolean;
|
||||||
property CurrentDirectory: string read fCurrentDirectory;
|
property CurrentDirectory: string read fCurrentDirectory;
|
||||||
property FilteredLines: TStringList read fFilteredOutput;
|
property FilteredLines: TStringList read fFilteredOutput;
|
||||||
|
property Lines: TStringList read fOutput;
|
||||||
property LastErrorType: TErrorType read fLastErrorType;
|
property LastErrorType: TErrorType read fLastErrorType;
|
||||||
property LastMessageType: TOutputMessageType read fLastMessageType;
|
property LastMessageType: TOutputMessageType read fLastMessageType;
|
||||||
property PrgSourceFilename: string
|
property PrgSourceFilename: string
|
||||||
@ -114,11 +117,13 @@ constructor TOutputFilter.Create;
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
fFilteredOutput:=TStringList.Create;
|
fFilteredOutput:=TStringList.Create;
|
||||||
|
fOutput:=TStringList.Create;
|
||||||
Clear;
|
Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOutputFilter.Clear;
|
procedure TOutputFilter.Clear;
|
||||||
begin
|
begin
|
||||||
|
fOutput.Clear;
|
||||||
fFilteredOutput.Clear;
|
fFilteredOutput.Clear;
|
||||||
if fCompilingHistory<>nil then fCompilingHistory.Clear;
|
if fCompilingHistory<>nil then fCompilingHistory.Clear;
|
||||||
if fMakeDirHistory<>nil then fMakeDirHistory.Clear;
|
if fMakeDirHistory<>nil then fMakeDirHistory.Clear;
|
||||||
@ -132,18 +137,16 @@ var
|
|||||||
OutputLine, Buf : String;
|
OutputLine, Buf : String;
|
||||||
ErrorExists: boolean;
|
ErrorExists: boolean;
|
||||||
begin
|
begin
|
||||||
|
Clear;
|
||||||
TheProcess.Execute;
|
TheProcess.Execute;
|
||||||
fCurrentDirectory:=TheProcess.CurrentDirectory;
|
fCurrentDirectory:=TheProcess.CurrentDirectory;
|
||||||
if fCurrentDirectory='' then fCurrentDirectory:=GetCurrentDir;
|
if fCurrentDirectory='' then fCurrentDirectory:=GetCurrentDir;
|
||||||
if (fCurrentDirectory<>'')
|
if (fCurrentDirectory<>'')
|
||||||
and (fCurrentDirectory[length(fCurrentDirectory)]<>PathDelim) then
|
and (fCurrentDirectory[length(fCurrentDirectory)]<>PathDelim) then
|
||||||
fCurrentDirectory:=fCurrentDirectory+PathDelim;
|
fCurrentDirectory:=fCurrentDirectory+PathDelim;
|
||||||
if fCompilingHistory<>nil then fCompilingHistory.Clear;
|
|
||||||
if fMakeDirHistory<>nil then fMakeDirHistory.Clear;
|
|
||||||
SetLength(Buf,BufSize);
|
SetLength(Buf,BufSize);
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
|
|
||||||
fFilteredOutput.Clear;
|
|
||||||
OutputLine:='';
|
OutputLine:='';
|
||||||
ErrorExists:=false;
|
ErrorExists:=false;
|
||||||
repeat
|
repeat
|
||||||
@ -179,6 +182,7 @@ begin
|
|||||||
writeln('TOutputFilter: "',s,'"');
|
writeln('TOutputFilter: "',s,'"');
|
||||||
fLastMessageType:=omtNone;
|
fLastMessageType:=omtNone;
|
||||||
fLastErrorType:=etNone;
|
fLastErrorType:=etNone;
|
||||||
|
fOutput.Add(s);
|
||||||
if DontFilterLine then begin
|
if DontFilterLine then begin
|
||||||
DoAddFilteredLine(s);
|
DoAddFilteredLine(s);
|
||||||
end else if (ofoSearchForFPCMessages in Options) and (ReadFPCompilerLine(s))
|
end else if (ofoSearchForFPCMessages in Options) and (ReadFPCompilerLine(s))
|
||||||
@ -237,10 +241,11 @@ begin
|
|||||||
else if ('Fatal: '=copy(s,1,length('Fatal: '))) then
|
else if ('Fatal: '=copy(s,1,length('Fatal: '))) then
|
||||||
fLastErrorType:=etFatal
|
fLastErrorType:=etFatal
|
||||||
else if ('Closing script ppas.sh'=s) then begin
|
else if ('Closing script ppas.sh'=s) then begin
|
||||||
|
// linker error
|
||||||
fLastMessageType:=omtLinker;
|
fLastMessageType:=omtLinker;
|
||||||
fLastErrorType:=etFatal;
|
fLastErrorType:=etFatal;
|
||||||
end;
|
end;
|
||||||
fFilteredOutput.Add(s);
|
DoAddFilteredLine(s);
|
||||||
if (ofoExceptionOnError in Options) then
|
if (ofoExceptionOnError in Options) then
|
||||||
raise EOutputFilterError.Create(s);
|
raise EOutputFilterError.Create(s);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -300,6 +305,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
SkipMessage:=not (Project.CompilerOptions.ShowErrors
|
SkipMessage:=not (Project.CompilerOptions.ShowErrors
|
||||||
or Project.CompilerOptions.ShowAll);
|
or Project.CompilerOptions.ShowAll);
|
||||||
|
if copy(s,j+2,length(s)-j-1)='Error while linking' then begin
|
||||||
|
DoAddLastLinkerMessages;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
etWarning:
|
etWarning:
|
||||||
@ -452,6 +460,21 @@ begin
|
|||||||
OnOutputString(s);
|
OnOutputString(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOutputFilter.DoAddLastLinkerMessages;
|
||||||
|
var i: integer;
|
||||||
|
begin
|
||||||
|
// read back to 'Linking' message
|
||||||
|
i:=fOutput.Count-1;
|
||||||
|
while (i>=0) and (LeftStr(fOutput[i],length('Linking '))<>'Linking ') do
|
||||||
|
dec(i);
|
||||||
|
inc(i);
|
||||||
|
while (i<fOutput.Count) do begin
|
||||||
|
if (fOutput[i]<>'') and (fOutput[i][1]='-') then
|
||||||
|
DoAddFilteredLine(fOutput[i]);
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TOutputFilter.SearchIncludeFile(const ShortIncFilename: string
|
function TOutputFilter.SearchIncludeFile(const ShortIncFilename: string
|
||||||
): string;
|
): string;
|
||||||
// search the include file and make it relative to the current start directory
|
// search the include file and make it relative to the current start directory
|
||||||
@ -497,6 +520,7 @@ end;
|
|||||||
destructor TOutputFilter.Destroy;
|
destructor TOutputFilter.Destroy;
|
||||||
begin
|
begin
|
||||||
fFilteredOutput.Free;
|
fFilteredOutput.Free;
|
||||||
|
fOutput.Free;
|
||||||
fMakeDirHistory.Free;
|
fMakeDirHistory.Free;
|
||||||
fCompilingHistory.Free;
|
fCompilingHistory.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user