Prechádzať zdrojové kódy

Merged revisions 11835 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r11835 | florian | 2008-09-28 20:45:37 +0200 (So, 28 Sep 2008) | 2 lines

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

git-svn-id: branches/fixes_2_2@11836 -

florian 17 rokov pred
rodič
commit
761aa1ade8
4 zmenil súbory, kde vykonal 35 pridanie a 2 odobranie
  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

@@ -8059,6 +8059,7 @@ tests/webtbs/tw12186.pp svneol=native#text/plain
 tests/webtbs/tw12214.pp svneol=native#text/plain
 tests/webtbs/tw1222.pp svneol=native#text/plain
 tests/webtbs/tw1223.pp svneol=native#text/plain
+tests/webtbs/tw12242.pp svneol=native#text/plain
 tests/webtbs/tw1228.pp svneol=native#text/plain
 tests/webtbs/tw1229.pp svneol=native#text/plain
 tests/webtbs/tw1250.pp svneol=native#text/plain

+ 1 - 1
compiler/pdecsub.pas

@@ -1868,7 +1868,7 @@ const
       mutexclpo     : []
     ),(
       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;
       pocall   : pocall_none;
       pooption : [po_staticmethod];

+ 4 - 1
compiler/symdef.pas

@@ -3110,9 +3110,12 @@ implementation
               not(is_void(returndef)) then
               s:=s+':'+returndef.GetTypeName;
         end;
+        s:=s+';';
         { forced calling convention? }
         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;
       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.