mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:49:23 +02:00
+ tsym.prettyname
* don't complain about unused compiler generated type symbols of generic specializations, resolves #13405 git-svn-id: trunk@13523 -
This commit is contained in:
parent
65690b9eee
commit
a1179733a7
@ -1743,8 +1743,8 @@ implementation
|
|||||||
constructor ttypesym.create(const n : string;def:tdef);
|
constructor ttypesym.create(const n : string;def:tdef);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited create(typesym,n);
|
inherited create(typesym,n);
|
||||||
typedef:=def;
|
typedef:=def;
|
||||||
{ register the typesym for the definition }
|
{ register the typesym for the definition }
|
||||||
if assigned(typedef) and
|
if assigned(typedef) and
|
||||||
(typedef.typ<>errordef) and
|
(typedef.typ<>errordef) and
|
||||||
|
@ -563,70 +563,73 @@ implementation
|
|||||||
if (tsym(sym).typ in [staticvarsym,localvarsym,paravarsym,fieldvarsym]) and
|
if (tsym(sym).typ in [staticvarsym,localvarsym,paravarsym,fieldvarsym]) and
|
||||||
((tsym(sym).owner.symtabletype in
|
((tsym(sym).owner.symtabletype in
|
||||||
[parasymtable,localsymtable,ObjectSymtable,staticsymtable])) then
|
[parasymtable,localsymtable,ObjectSymtable,staticsymtable])) then
|
||||||
begin
|
begin
|
||||||
{ unused symbol should be reported only if no }
|
{ unused symbol should be reported only if no }
|
||||||
{ error is reported }
|
{ error is reported }
|
||||||
{ if the symbol is in a register it is used }
|
{ if the symbol is in a register it is used }
|
||||||
{ also don't count the value parameters which have local copies }
|
{ also don't count the value parameters which have local copies }
|
||||||
{ also don't claim for high param of open parameters (PM) }
|
{ also don't claim for high param of open parameters (PM) }
|
||||||
if (Errorcount<>0) or
|
if (Errorcount<>0) or
|
||||||
([vo_is_hidden_para,vo_is_funcret] * tabstractvarsym(sym).varoptions = [vo_is_hidden_para]) then
|
([vo_is_hidden_para,vo_is_funcret] * tabstractvarsym(sym).varoptions = [vo_is_hidden_para]) then
|
||||||
exit;
|
exit;
|
||||||
if (tstoredsym(sym).refs=0) then
|
if (tstoredsym(sym).refs=0) then
|
||||||
begin
|
begin
|
||||||
if (vo_is_funcret in tabstractvarsym(sym).varoptions) then
|
if (vo_is_funcret in tabstractvarsym(sym).varoptions) then
|
||||||
begin
|
begin
|
||||||
{ don't warn about the result of constructors }
|
{ don't warn about the result of constructors }
|
||||||
if ((tsym(sym).owner.symtabletype<>localsymtable) or
|
if ((tsym(sym).owner.symtabletype<>localsymtable) or
|
||||||
(tprocdef(tsym(sym).owner.defowner).proctypeoption<>potype_constructor)) and
|
(tprocdef(tsym(sym).owner.defowner).proctypeoption<>potype_constructor)) and
|
||||||
not(cs_opt_nodedfa in current_settings.optimizerswitches) then
|
not(cs_opt_nodedfa in current_settings.optimizerswitches) then
|
||||||
MessagePos(tsym(sym).fileinfo,sym_w_function_result_not_set)
|
MessagePos(tsym(sym).fileinfo,sym_w_function_result_not_set)
|
||||||
end
|
end
|
||||||
else if (tsym(sym).owner.symtabletype=parasymtable) then
|
else if (tsym(sym).owner.symtabletype=parasymtable) then
|
||||||
MessagePos1(tsym(sym).fileinfo,sym_h_para_identifier_not_used,tsym(sym).realname)
|
MessagePos1(tsym(sym).fileinfo,sym_h_para_identifier_not_used,tsym(sym).prettyname)
|
||||||
else if (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
else if (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
||||||
MessagePos2(tsym(sym).fileinfo,sym_n_private_identifier_not_used,tsym(sym).owner.realname^,tsym(sym).realname)
|
MessagePos2(tsym(sym).fileinfo,sym_n_private_identifier_not_used,tsym(sym).owner.realname^,tsym(sym).prettyname)
|
||||||
else
|
else
|
||||||
MessagePos1(tsym(sym).fileinfo,sym_n_local_identifier_not_used,tsym(sym).realname);
|
MessagePos1(tsym(sym).fileinfo,sym_n_local_identifier_not_used,tsym(sym).prettyname);
|
||||||
end
|
end
|
||||||
else if tabstractvarsym(sym).varstate in [vs_written,vs_initialised] then
|
else if tabstractvarsym(sym).varstate in [vs_written,vs_initialised] then
|
||||||
begin
|
begin
|
||||||
if (tsym(sym).owner.symtabletype=parasymtable) then
|
if (tsym(sym).owner.symtabletype=parasymtable) then
|
||||||
begin
|
begin
|
||||||
if not(tabstractvarsym(sym).varspez in [vs_var,vs_out]) and
|
if not(tabstractvarsym(sym).varspez in [vs_var,vs_out]) and
|
||||||
not(vo_is_funcret in tabstractvarsym(sym).varoptions) then
|
not(vo_is_funcret in tabstractvarsym(sym).varoptions) then
|
||||||
MessagePos1(tsym(sym).fileinfo,sym_h_para_identifier_only_set,tsym(sym).realname)
|
MessagePos1(tsym(sym).fileinfo,sym_h_para_identifier_only_set,tsym(sym).prettyname)
|
||||||
end
|
end
|
||||||
else if (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
else if (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
||||||
MessagePos2(tsym(sym).fileinfo,sym_n_private_identifier_only_set,tsym(sym).owner.realname^,tsym(sym).realname)
|
MessagePos2(tsym(sym).fileinfo,sym_n_private_identifier_only_set,tsym(sym).owner.realname^,tsym(sym).prettyname)
|
||||||
else if tabstractvarsym(sym).varoptions*[vo_is_funcret,vo_is_public,vo_is_external]=[] then
|
else if tabstractvarsym(sym).varoptions*[vo_is_funcret,vo_is_public,vo_is_external]=[] then
|
||||||
MessagePos1(tsym(sym).fileinfo,sym_n_local_identifier_only_set,tsym(sym).realname);
|
MessagePos1(tsym(sym).fileinfo,sym_n_local_identifier_only_set,tsym(sym).prettyname);
|
||||||
end
|
end
|
||||||
else if (tabstractvarsym(sym).varstate = vs_read_not_warned) and
|
else if (tabstractvarsym(sym).varstate = vs_read_not_warned) and
|
||||||
([vo_is_public,vo_is_external] * tabstractvarsym(sym).varoptions = []) then
|
([vo_is_public,vo_is_external] * tabstractvarsym(sym).varoptions = []) then
|
||||||
MessagePos1(tsym(sym).fileinfo,sym_w_identifier_only_read,tsym(sym).realname)
|
MessagePos1(tsym(sym).fileinfo,sym_w_identifier_only_read,tsym(sym).prettyname)
|
||||||
end
|
end
|
||||||
else if ((tsym(sym).owner.symtabletype in
|
else if ((tsym(sym).owner.symtabletype in
|
||||||
[ObjectSymtable,parasymtable,localsymtable,staticsymtable])) then
|
[ObjectSymtable,parasymtable,localsymtable,staticsymtable])) then
|
||||||
begin
|
begin
|
||||||
if (Errorcount<>0) or
|
if (Errorcount<>0) or
|
||||||
(sp_internal in tsym(sym).symoptions) then
|
(sp_internal in tsym(sym).symoptions) then
|
||||||
exit;
|
exit;
|
||||||
{ do not claim for inherited private fields !! }
|
{ do not claim for inherited private fields !! }
|
||||||
if (Tsym(sym).refs=0) and (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
if (tsym(sym).refs=0) and (tsym(sym).owner.symtabletype=ObjectSymtable) then
|
||||||
MessagePos2(tsym(sym).fileinfo,sym_n_private_method_not_used,tsym(sym).owner.realname^,tsym(sym).realname)
|
MessagePos2(tsym(sym).fileinfo,sym_n_private_method_not_used,tsym(sym).owner.realname^,tsym(sym).prettyname)
|
||||||
{ units references are problematic }
|
{ units references are problematic }
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if (Tsym(sym).refs=0) and
|
if (tsym(sym).refs=0) and
|
||||||
not(tsym(sym).typ in [enumsym,unitsym]) and
|
not(tsym(sym).typ in [enumsym,unitsym]) and
|
||||||
not(is_funcret_sym(tsym(sym))) and
|
not(is_funcret_sym(tsym(sym))) and
|
||||||
|
{ don't complain about compiler generated syms for specializations, see also #13405 }
|
||||||
|
not((tsym(sym).typ=typesym) and (df_specialization in ttypesym(sym).typedef.defoptions) and
|
||||||
|
(pos('$',ttypesym(sym).Realname)<>0)) and
|
||||||
(
|
(
|
||||||
(tsym(sym).typ<>procsym) or
|
(tsym(sym).typ<>procsym) or
|
||||||
((tsym(sym).owner.symtabletype=staticsymtable) and
|
((tsym(sym).owner.symtabletype=staticsymtable) and
|
||||||
not current_module.is_unit)
|
not current_module.is_unit)
|
||||||
) then
|
) then
|
||||||
MessagePos2(tsym(sym).fileinfo,sym_h_local_symbol_not_used,SymTypeName[tsym(sym).typ],tsym(sym).realname);
|
MessagePos2(tsym(sym).fileinfo,sym_h_local_symbol_not_used,SymTypeName[tsym(sym).typ],tsym(sym).prettyname);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -105,6 +105,7 @@ interface
|
|||||||
constructor create(st:tsymtyp;const aname:string);
|
constructor create(st:tsymtyp;const aname:string);
|
||||||
destructor destroy;override;
|
destructor destroy;override;
|
||||||
function mangledname:string; virtual;
|
function mangledname:string; virtual;
|
||||||
|
function prettyname:string; virtual;
|
||||||
procedure buildderef;virtual;
|
procedure buildderef;virtual;
|
||||||
procedure deref;virtual;
|
procedure deref;virtual;
|
||||||
procedure ChangeOwner(st:TSymtable);
|
procedure ChangeOwner(st:TSymtable);
|
||||||
@ -388,6 +389,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tsym.prettyname : string;
|
||||||
|
begin
|
||||||
|
result:=realname;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tsym.ChangeOwner(st:TSymtable);
|
procedure tsym.ChangeOwner(st:TSymtable);
|
||||||
begin
|
begin
|
||||||
Owner:=st;
|
Owner:=st;
|
||||||
|
Loading…
Reference in New Issue
Block a user