mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-08 14:25:57 +02:00
* do not issue a hint about uninitialized var-parameters, resolves #25916
git-svn-id: trunk@29289 -
This commit is contained in:
parent
21dcedb18e
commit
f1eb00a450
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -14103,6 +14103,8 @@ tests/webtbs/tw25869.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2588.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2589.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25895.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25916a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25916b.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25929.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25930.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25931.pp -text svneol=native#text/plain
|
||||
|
@ -1334,7 +1334,12 @@ implementation
|
||||
{ iterate through life info of the first node }
|
||||
for i:=0 to dfabuilder.nodemap.count-1 do
|
||||
begin
|
||||
if DFASetIn(GetUserCode.optinfo^.life,i) then
|
||||
if DFASetIn(GetUserCode.optinfo^.life,i) and
|
||||
{ do not warn about parameters passed by var }
|
||||
not((tnode(dfabuilder.nodemap[i]).nodetype=loadn) and (tloadnode(dfabuilder.nodemap[i]).symtableentry.typ=paravarsym) and
|
||||
(tparavarsym(tloadnode(dfabuilder.nodemap[i]).symtableentry).varspez=vs_var) and
|
||||
{ function result is passed by var but it must be initialized }
|
||||
not(vo_is_funcret in tparavarsym(tloadnode(dfabuilder.nodemap[i]).symtableentry).varoptions)) then
|
||||
CheckAndWarn(GetUserCode,tnode(dfabuilder.nodemap[i]));
|
||||
end;
|
||||
end;
|
||||
|
14
tests/webtbs/tw25916a.pp
Normal file
14
tests/webtbs/tw25916a.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{ %OPT=-Sh}
|
||||
{$MODE OBJFPC}
|
||||
{$OPTIMIZATION DFA}
|
||||
{$HINTS ON}
|
||||
program test;
|
||||
|
||||
procedure TestText(var F: Text);
|
||||
begin
|
||||
Writeln(F, 'Test'); // Hint: Local variable "F" does not seem to be initialized
|
||||
end;
|
||||
|
||||
begin
|
||||
TestText(Output);
|
||||
end.
|
13
tests/webtbs/tw25916b.pp
Normal file
13
tests/webtbs/tw25916b.pp
Normal file
@ -0,0 +1,13 @@
|
||||
{ %OPT=-Sh}
|
||||
{$MODE OBJFPC}
|
||||
{$OPTIMIZATION DFA}
|
||||
{$HINTS ON}
|
||||
program test;
|
||||
|
||||
procedure TestText(var F: longint);
|
||||
begin
|
||||
TestText(F);
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user