From 8c9baed5cb42e878e932f36b4e3d1b3fd988dc5e Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 28 Sep 2008 18:45:37 +0000 Subject: [PATCH] * force static; being repeated in the procedure body, this avoids trouble as in #12242 + add static when using fullprocname git-svn-id: trunk@11835 - --- .gitattributes | 1 + compiler/pdecsub.pas | 2 +- compiler/symdef.pas | 5 ++++- tests/webtbs/tw12242.pp | 29 +++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tests/webtbs/tw12242.pp diff --git a/.gitattributes b/.gitattributes index d0ca019557..5d21379231 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8564,6 +8564,7 @@ tests/webtbs/tw1222.pp svneol=native#text/plain tests/webtbs/tw12224.pp svneol=native#text/plain tests/webtbs/tw1223.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/tw1229.pp svneol=native#text/plain tests/webtbs/tw1250.pp svneol=native#text/plain diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index 75a9a19af1..1cc9752796 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -1920,7 +1920,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]; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index e2273639ec..d1589edc3a 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -3149,9 +3149,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; diff --git a/tests/webtbs/tw12242.pp b/tests/webtbs/tw12242.pp new file mode 100644 index 0000000000..e2c207084b --- /dev/null +++ b/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.