mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 19:29:33 +02:00
* handle interface methods with cdecl modifier correctly, second and final part to resolve #10684
git-svn-id: trunk@12828 -
This commit is contained in:
parent
cc622779c9
commit
67d1604c49
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8623,6 +8623,7 @@ tests/webtbs/tw1066a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1066b.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1068.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10681.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10684.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1071.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10727.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1073.pp svneol=native#text/plain
|
||||
|
@ -563,7 +563,7 @@ unit cgcpu;
|
||||
|
||||
}
|
||||
|
||||
procedure getselftoeax(offs: longint);
|
||||
procedure getselftoeax(offs: longint);
|
||||
var
|
||||
href : treference;
|
||||
selfoffsetfromsp : longint;
|
||||
@ -581,7 +581,7 @@ unit cgcpu;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure loadvmttoeax;
|
||||
procedure loadvmttoeax;
|
||||
var
|
||||
href : treference;
|
||||
begin
|
||||
@ -590,7 +590,7 @@ unit cgcpu;
|
||||
cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_EAX);
|
||||
end;
|
||||
|
||||
procedure op_oneaxmethodaddr(op: TAsmOp);
|
||||
procedure op_oneaxmethodaddr(op: TAsmOp);
|
||||
var
|
||||
href : treference;
|
||||
begin
|
||||
@ -601,7 +601,7 @@ unit cgcpu;
|
||||
list.concat(taicpu.op_ref(op,S_L,href));
|
||||
end;
|
||||
|
||||
procedure loadmethodoffstoeax;
|
||||
procedure loadmethodoffstoeax;
|
||||
var
|
||||
href : treference;
|
||||
begin
|
||||
@ -633,9 +633,9 @@ unit cgcpu;
|
||||
make_global:=true;
|
||||
|
||||
if make_global then
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0))
|
||||
else
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
List.concat(Tai_symbol.Createname(labelname,AT_FUNCTION,0));
|
||||
|
||||
{ set param1 interface to self }
|
||||
g_adjust_self_value(list,procdef,ioffset);
|
||||
@ -657,6 +657,7 @@ unit cgcpu;
|
||||
end;
|
||||
{ restore param1 value self to interface }
|
||||
g_adjust_self_value(list,procdef,-ioffset);
|
||||
list.concat(taicpu.op_none(A_RET,S_L));
|
||||
end
|
||||
else if po_virtualmethod in procdef.procoptions then
|
||||
begin
|
||||
|
48
tests/webtbs/tw10684.pp
Normal file
48
tests/webtbs/tw10684.pp
Normal file
@ -0,0 +1,48 @@
|
||||
program test_intf_query;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Classes;
|
||||
|
||||
type
|
||||
ISimple = interface
|
||||
['{24811FF3-4F01-4601-AC5C-22A5B5D46928}']
|
||||
function ShowSomething: Integer; cdecl;
|
||||
function GetIsBlob: Boolean; cdecl;
|
||||
end;
|
||||
|
||||
TSimple = class(TInterfacedObject, ISimple)
|
||||
protected
|
||||
{ ISimple implementation }
|
||||
function ShowSomething: Integer; cdecl;
|
||||
function GetIsBlob: Boolean; cdecl;
|
||||
end;
|
||||
|
||||
function QuerySimple(const OnChange: TNotifyEvent = nil): ISimple; cdecl;
|
||||
begin
|
||||
Result := TSimple.Create;
|
||||
end;
|
||||
|
||||
function TSimple.ShowSomething: Integer; cdecl;
|
||||
begin
|
||||
Writeln('Message from ISimple');
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TSimple.GetIsBlob: Boolean; cdecl;
|
||||
begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
{*** main program ***}
|
||||
|
||||
var
|
||||
FSimple: ISimple;
|
||||
|
||||
begin
|
||||
FSimple := QuerySimple;
|
||||
FSimple.ShowSomething;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user