* 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 -
This commit is contained in:
sergei 2014-05-15 21:16:36 +00:00
parent 141ead4e62
commit 3eec9996bc
2 changed files with 23 additions and 18 deletions

View File

@ -221,7 +221,6 @@ interface
procedure flagdependent(callermodule:tmodule);
function addusedunit(hp:tmodule;inuses:boolean;usym:tunitsym):tused_unit;
procedure updatemaps;
procedure check_hints;
function derefidx_unit(id:longint):longint;
function resolve_unit(id:longint):tmodule;
procedure allunitsused;
@ -240,6 +239,7 @@ interface
u : tmodule;
unitsym : tunitsym;
constructor create(_u : tmodule;intface,inuses:boolean;usym:tunitsym);
procedure check_hints;
end;
tdependent_unit = class(tlinkedlistitem)
@ -475,6 +475,27 @@ implementation
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
****************************************************************************}
@ -899,22 +920,6 @@ implementation
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;

View File

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