浏览代码

* force static; being repeated in the procedure body, this avoids trouble as in #12242
+ add static when using fullprocname

git-svn-id: trunk@11835 -

florian 17 年之前
父节点
当前提交
8c9baed5cb
共有 4 个文件被更改,包括 35 次插入2 次删除
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pdecsub.pas
  3. 4 1
      compiler/symdef.pas
  4. 29 0
      tests/webtbs/tw12242.pp

+ 1 - 0
.gitattributes

@@ -8564,6 +8564,7 @@ tests/webtbs/tw1222.pp svneol=native#text/plain
 tests/webtbs/tw12224.pp svneol=native#text/plain
 tests/webtbs/tw12224.pp svneol=native#text/plain
 tests/webtbs/tw1223.pp svneol=native#text/plain
 tests/webtbs/tw1223.pp svneol=native#text/plain
 tests/webtbs/tw12233.pp svneol=native#text/plain
 tests/webtbs/tw12233.pp svneol=native#text/plain
+tests/webtbs/tw12242.pp svneol=native#text/plain
 tests/webtbs/tw1228.pp svneol=native#text/plain
 tests/webtbs/tw1228.pp svneol=native#text/plain
 tests/webtbs/tw1229.pp svneol=native#text/plain
 tests/webtbs/tw1229.pp svneol=native#text/plain
 tests/webtbs/tw1250.pp svneol=native#text/plain
 tests/webtbs/tw1250.pp svneol=native#text/plain

+ 1 - 1
compiler/pdecsub.pas

@@ -1920,7 +1920,7 @@ const
       mutexclpo     : []
       mutexclpo     : []
     ),(
     ),(
       idtok:_STATIC;
       idtok:_STATIC;
-      pd_flags : [pd_interface,pd_object,pd_notobjintf];
+      pd_flags : [pd_interface,pd_implemen,pd_body,pd_object,pd_notobjintf];
       handler  : @pd_static;
       handler  : @pd_static;
       pocall   : pocall_none;
       pocall   : pocall_none;
       pooption : [po_staticmethod];
       pooption : [po_staticmethod];

+ 4 - 1
compiler/symdef.pas

@@ -3149,9 +3149,12 @@ implementation
               not(is_void(returndef)) then
               not(is_void(returndef)) then
               s:=s+':'+returndef.GetTypeName;
               s:=s+':'+returndef.GetTypeName;
         end;
         end;
+        s:=s+';';
         { forced calling convention? }
         { forced calling convention? }
         if (po_hascallingconvention in procoptions) then
         if (po_hascallingconvention in procoptions) then
-          s:=s+';'+ProcCallOptionStr[proccalloption];
+          s:=s+' '+ProcCallOptionStr[proccalloption]+';';
+        if po_staticmethod in procoptions then
+          s:=s+' Static;';
         fullprocname:=s;
         fullprocname:=s;
       end;
       end;
 
 

+ 29 - 0
tests/webtbs/tw12242.pp

@@ -0,0 +1,29 @@
+{
+ staticbug.pas
+
+ With FPC 2.2.2:
+
+ staticbug.lpr(24,31) Error: function header doesn't match the previous declaration "class TMyController.doClose(Pointer, Pointer, Pointer);CDecl"
+}
+program staticbug;
+
+{$mode delphi}{$STATIC ON}
+
+uses
+  Classes, SysUtils;
+
+type
+
+  { TMyController }
+
+  TMyController = class
+  public
+    class procedure doClose(_self: Pointer; _cmd: Pointer; sender: Pointer); cdecl; static;
+  end;
+
+class procedure TMyController.doClose(_self: Pointer; _cmd: Pointer; sender: Pointer); cdecl; static;
+begin
+end;
+
+begin
+end.