Ver código fonte

+ don't abuse status.currentsourcepath to pass on PPU names if the source is unavailable, causes side effects with other frontends (like the IDE). Improved solution for Mantis #27588

git-svn-id: trunk@30373 -
Károly Balogh 10 anos atrás
pai
commit
72e1443081
2 arquivos alterados com 11 adições e 6 exclusões
  1. 7 1
      compiler/comphook.pas
  2. 4 5
      compiler/verbose.pas

+ 7 - 1
compiler/comphook.pas

@@ -72,6 +72,8 @@ type
   TCompilerStatus = record
   TCompilerStatus = record
   { Current status }
   { Current status }
     currentmodule,
     currentmodule,
+    currentsourceppufilename, { the name of the ppu where the source file
+                                comes from where the error location is given }
     currentsourcepath,
     currentsourcepath,
     currentsource : string;   { filename }
     currentsource : string;   { filename }
     currentline,
     currentline,
@@ -104,6 +106,7 @@ type
     use_redir,
     use_redir,
     use_bugreport,
     use_bugreport,
     use_gccoutput,
     use_gccoutput,
+    sources_avail,
     print_source_path : boolean;
     print_source_path : boolean;
   { Redirection support }
   { Redirection support }
     redirfile : text;
     redirfile : text;
@@ -310,7 +313,10 @@ begin
               ','+tostr(status.currentcolumn)+') '+hs+' '+s;
               ','+tostr(status.currentcolumn)+') '+hs+' '+s;
           end;
           end;
         if status.print_source_path then
         if status.print_source_path then
-          hs:=status.currentsourcepath+hs;
+          if status.sources_avail then
+            hs:=status.currentsourcepath+hs
+          else
+            hs:=status.currentsourceppufilename+':'+hs;
       end
       end
      else
      else
       begin
       begin

+ 4 - 5
compiler/verbose.pas

@@ -451,15 +451,13 @@ implementation
             begin
             begin
               { update status record }
               { update status record }
               status.currentmodule:=module.modulename^;
               status.currentmodule:=module.modulename^;
+              status.currentsourceppufilename:=module.ppufilename;
               status.currentmodulestate:=ModuleStateStr[module.state];
               status.currentmodulestate:=ModuleStateStr[module.state];
               status.currentsource:=module.sourcefiles.get_file_name(current_filepos.fileindex);
               status.currentsource:=module.sourcefiles.get_file_name(current_filepos.fileindex);
               status.currentsourcepath:=module.sourcefiles.get_file_path(current_filepos.fileindex);
               status.currentsourcepath:=module.sourcefiles.get_file_path(current_filepos.fileindex);
-              { if sources are not available, construct a prefix from the
-                ppu file name }
-              if not(module.sources_avail) then
-                status.currentsourcepath:=module.ppufilename+':'
+              status.sources_avail:=module.sources_avail;
               { if currentsourcepath is relative, make it absolute }
               { if currentsourcepath is relative, make it absolute }
-              else if not path_absolute(status.currentsourcepath) then
+              if not path_absolute(status.currentsourcepath) then
                 status.currentsourcepath:=GetCurrentDir+status.currentsourcepath;
                 status.currentsourcepath:=GetCurrentDir+status.currentsourcepath;
 
 
               { update lastfileidx only if name known PM }
               { update lastfileidx only if name known PM }
@@ -1002,6 +1000,7 @@ implementation
         lastfileidx:=-1;
         lastfileidx:=-1;
         lastmoduleidx:=-1;
         lastmoduleidx:=-1;
         status.currentmodule:='';
         status.currentmodule:='';
+        status.currentsourceppufilename:='';
         status.currentsource:='';
         status.currentsource:='';
         status.currentsourcepath:='';
         status.currentsourcepath:='';
         { Register internalerrorproc for cutils/cclasses }
         { Register internalerrorproc for cutils/cclasses }