Browse Source

* fixed showing of warnings for uninitialised function results

git-svn-id: trunk@1897 -
Jonas Maebe 19 years ago
parent
commit
7996bb3b06
2 changed files with 4 additions and 3 deletions
  1. 3 2
      compiler/htypechk.pas
  2. 1 1
      compiler/symtable.pas

+ 3 - 2
compiler/htypechk.pas

@@ -776,8 +776,9 @@ implementation
                         { Give warning/note for uninitialized locals }
                         { Give warning/note for uninitialized locals }
                         if assigned(hsym.owner) and
                         if assigned(hsym.owner) and
                            not(vo_is_external in hsym.varoptions) and
                            not(vo_is_external in hsym.varoptions) and
-                           (hsym.owner.symtabletype in [localsymtable,staticsymtable]) and
-                           (hsym.owner=current_procinfo.procdef.localst) then
+                           (hsym.owner.symtabletype in [parasymtable,localsymtable,staticsymtable]) and
+                           ((hsym.owner=current_procinfo.procdef.localst) or
+                            (vo_is_funcret in hsym.varoptions)) then
                           begin
                           begin
                             if (vo_is_funcret in hsym.varoptions) then
                             if (vo_is_funcret in hsym.varoptions) then
                                CGMessage(sym_w_function_result_not_set)
                                CGMessage(sym_w_function_result_not_set)

+ 1 - 1
compiler/symtable.pas

@@ -701,7 +701,7 @@ implementation
            { 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 in tabstractvarsym(p).varoptions) then
+              ([vo_is_hidden_para,vo_is_funcret] * tabstractvarsym(p).varoptions = [vo_is_hidden_para]) then
              exit;
              exit;
            if (tstoredsym(p).refs=0) then
            if (tstoredsym(p).refs=0) then
              begin
              begin