Răsfoiți Sursa

* Moved method check_hints from tmodule to tused_unit and modified it so warning messages are output with position info from associated unitsym. Resolves #25057.

git-svn-id: trunk@27795 -
sergei 11 ani în urmă
părinte
comite
3eec9996bc
2 a modificat fișierele cu 23 adăugiri și 18 ștergeri
  1. 22 17
      compiler/fmodule.pas
  2. 1 1
      compiler/pmodules.pas

+ 22 - 17
compiler/fmodule.pas

@@ -221,7 +221,6 @@ interface
         procedure flagdependent(callermodule:tmodule);
         procedure flagdependent(callermodule:tmodule);
         function  addusedunit(hp:tmodule;inuses:boolean;usym:tunitsym):tused_unit;
         function  addusedunit(hp:tmodule;inuses:boolean;usym:tunitsym):tused_unit;
         procedure updatemaps;
         procedure updatemaps;
-        procedure check_hints;
         function  derefidx_unit(id:longint):longint;
         function  derefidx_unit(id:longint):longint;
         function  resolve_unit(id:longint):tmodule;
         function  resolve_unit(id:longint):tmodule;
         procedure allunitsused;
         procedure allunitsused;
@@ -240,6 +239,7 @@ interface
           u               : tmodule;
           u               : tmodule;
           unitsym         : tunitsym;
           unitsym         : tunitsym;
           constructor create(_u : tmodule;intface,inuses:boolean;usym:tunitsym);
           constructor create(_u : tmodule;intface,inuses:boolean;usym:tunitsym);
+          procedure check_hints;
        end;
        end;
 
 
        tdependent_unit = class(tlinkedlistitem)
        tdependent_unit = class(tlinkedlistitem)
@@ -475,6 +475,27 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tused_unit.check_hints;
+      var
+        uname: pshortstring;
+      begin
+        uname:=u.realmodulename;
+        if mo_hint_deprecated in u.moduleoptions then
+          if (mo_has_deprecated_msg in u.moduleoptions) and (u.deprecatedmsg <> nil) then
+            MessagePos2(unitsym.fileinfo,sym_w_deprecated_unit_with_msg,uname^,u.deprecatedmsg^)
+          else
+            MessagePos1(unitsym.fileinfo,sym_w_deprecated_unit,uname^);
+        if mo_hint_experimental in u.moduleoptions then
+          MessagePos1(unitsym.fileinfo,sym_w_experimental_unit,uname^);
+        if mo_hint_platform in u.moduleoptions then
+          MessagePos1(unitsym.fileinfo,sym_w_non_portable_unit,uname^);
+        if mo_hint_library in u.moduleoptions then
+          MessagePos1(unitsym.fileinfo,sym_w_library_unit,uname^);
+        if mo_hint_unimplemented in u.moduleoptions then
+          MessagePos1(unitsym.fileinfo,sym_w_non_implemented_unit,uname^);
+      end;
+
+
 {****************************************************************************
 {****************************************************************************
                             TDENPENDENT_UNIT
                             TDENPENDENT_UNIT
  ****************************************************************************}
  ****************************************************************************}
@@ -899,22 +920,6 @@ implementation
           end;
           end;
       end;
       end;
 
 
-    procedure tmodule.check_hints;
-      begin
-        if mo_hint_deprecated in moduleoptions then
-          if (mo_has_deprecated_msg in moduleoptions) and (deprecatedmsg <> nil) then
-            Message2(sym_w_deprecated_unit_with_msg,realmodulename^,deprecatedmsg^)
-          else
-            Message1(sym_w_deprecated_unit,realmodulename^);
-        if mo_hint_experimental in moduleoptions then
-          Message1(sym_w_experimental_unit,realmodulename^);
-        if mo_hint_platform in moduleoptions then
-          Message1(sym_w_non_portable_unit,realmodulename^);
-        if mo_hint_library in moduleoptions then
-          Message1(sym_w_library_unit,realmodulename^);
-        if mo_hint_unimplemented in moduleoptions then
-          Message1(sym_w_non_implemented_unit,realmodulename^);
-      end;
 
 
 
 
     function tmodule.derefidx_unit(id:longint):longint;
     function tmodule.derefidx_unit(id:longint):longint;

+ 1 - 1
compiler/pmodules.pas

@@ -503,7 +503,7 @@ implementation
                   assigned(pu.u.globalmacrosymtable) then
                   assigned(pu.u.globalmacrosymtable) then
                  macrosymtablestack.push(pu.u.globalmacrosymtable);
                  macrosymtablestack.push(pu.u.globalmacrosymtable);
                { check hints }
                { check hints }
-               pu.u.check_hints;
+               pu.check_hints;
              end;
              end;
             pu:=tused_unit(pu.next);
             pu:=tused_unit(pu.next);
           end;
           end;