Browse Source

* don't print "parameter not used" hints for abstract methods (mantis #30431)

git-svn-id: trunk@34281 -
Jonas Maebe 9 years ago
parent
commit
c752050728
3 changed files with 26 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/symtable.pas
  3. 22 0
      tests/webtbs/tw30431.pp

+ 1 - 0
.gitattributes

@@ -15193,6 +15193,7 @@ tests/webtbs/tw30329.pp -text svneol=native#text/plain
 tests/webtbs/tw30357.pp svneol=native#text/pascal
 tests/webtbs/tw3038.pp svneol=native#text/plain
 tests/webtbs/tw3041.pp svneol=native#text/plain
+tests/webtbs/tw30431.pp svneol=native#text/plain
 tests/webtbs/tw30443.pp svneol=native#text/plain
 tests/webtbs/tw3045.pp svneol=native#text/plain
 tests/webtbs/tw3048.pp svneol=native#text/plain

+ 3 - 1
compiler/symtable.pas

@@ -864,12 +864,14 @@ implementation
             { also don't claim for high param of open parameters    (PM)     }
             { also don't complain about unused symbols in generic procedures }
             { and methods                                                    }
+            { and neither in abstract methods                                }
             if (Errorcount<>0) or
                ([vo_is_hidden_para,vo_is_funcret] * tabstractvarsym(sym).varoptions = [vo_is_hidden_para]) or
                (sp_internal in tsym(sym).symoptions) or
                ((assigned(tsym(sym).owner.defowner) and
                 (tsym(sym).owner.defowner.typ=procdef) and
-                (df_generic in tprocdef(tsym(sym).owner.defowner).defoptions))) then
+                ((df_generic in tprocdef(tsym(sym).owner.defowner).defoptions) or
+                 (po_abstractmethod in tprocdef(tsym(sym).owner.defowner).procoptions)))) then
               exit;
             if (tstoredsym(sym).refs=0) then
               begin

+ 22 - 0
tests/webtbs/tw30431.pp

@@ -0,0 +1,22 @@
+{ %opt=-vh -Seh }
+{ %norun }
+
+program NotUsedParamInAbstractMethodBug;
+
+{$mode objfpc}{$H+}
+
+type
+  { TXMLWriter }
+
+  TXMLWriter = class(TObject)
+  private
+  protected
+    procedure Write(const Buffer; Count: Longint); virtual; abstract;
+  public
+  end;
+
+var
+  x: TXMLWriter;
+begin
+end.
+