瀏覽代碼

* write the file location (if available), if a unit is not found, resolves #21514

git-svn-id: trunk@20583 -
florian 13 年之前
父節點
當前提交
4cf4c65502
共有 2 個文件被更改,包括 17 次插入1 次删除
  1. 14 1
      compiler/fppu.pas
  2. 3 0
      compiler/pmodules.pas

+ 14 - 1
compiler/fppu.pas

@@ -1484,6 +1484,7 @@ var
         do_load,
         do_load,
         second_time        : boolean;
         second_time        : boolean;
         old_current_module : tmodule;
         old_current_module : tmodule;
+        pu : tused_unit;
       begin
       begin
         old_current_module:=current_module;
         old_current_module:=current_module;
         Message3(unit_u_load_unit,old_current_module.modulename^,
         Message3(unit_u_load_unit,old_current_module.modulename^,
@@ -1620,7 +1621,19 @@ var
                   begin
                   begin
                     printcomments;
                     printcomments;
                     if recompile_reason=rr_noppu then
                     if recompile_reason=rr_noppu then
-                      Message2(unit_f_cant_find_ppu,realmodulename^,loaded_from.realmodulename^)
+                      begin
+                        pu:=tused_unit(loaded_from.used_units.first);
+                        while assigned(pu) do
+                          begin
+                            if pu.u=self then
+                              break;
+                            pu:=tused_unit(pu.next);
+                          end;
+                        if assigned(pu) then
+                          MessagePos2(pu.unitsym.fileinfo,unit_f_cant_find_ppu,realmodulename^,loaded_from.realmodulename^)
+                        else
+                          Message2(unit_f_cant_find_ppu,realmodulename^,loaded_from.realmodulename^);
+                      end
                     else
                     else
                       Message1(unit_f_cant_compile_unit,realmodulename^);
                       Message1(unit_f_cant_compile_unit,realmodulename^);
                   end;
                   end;

+ 3 - 0
compiler/pmodules.pas

@@ -761,11 +761,13 @@ implementation
          pu      : tused_unit;
          pu      : tused_unit;
          hp2     : tmodule;
          hp2     : tmodule;
          unitsym : tunitsym;
          unitsym : tunitsym;
+         filepos : tfileposinfo;
       begin
       begin
          consume(_USES);
          consume(_USES);
          repeat
          repeat
            s:=pattern;
            s:=pattern;
            sorg:=orgpattern;
            sorg:=orgpattern;
+           filepos:=current_tokenpos;
            consume(_ID);
            consume(_ID);
            while token=_POINT do
            while token=_POINT do
              begin
              begin
@@ -811,6 +813,7 @@ implementation
               { Create unitsym, we need to use the name as specified, we
               { Create unitsym, we need to use the name as specified, we
                 can not use the modulename because that can be different
                 can not use the modulename because that can be different
                 when -Un is used }
                 when -Un is used }
+              current_tokenpos:=filepos;
               unitsym:=tunitsym.create(sorg,nil);
               unitsym:=tunitsym.create(sorg,nil);
               tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
               tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
               { the current module uses the unit hp2 }
               { the current module uses the unit hp2 }