mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 14:49:16 +02:00
+ introduce the tcnf_proc_2_procvar_2_voidpointer flag (for now it is only set,
but not used) git-svn-id: trunk@38638 -
This commit is contained in:
parent
3e9b9451b4
commit
c665866517
@ -104,7 +104,7 @@ implementation
|
|||||||
|
|
||||||
function ti8086inlinenode.typecheck_seg: tnode;
|
function ti8086inlinenode.typecheck_seg: tnode;
|
||||||
var
|
var
|
||||||
isprocvar: Boolean;
|
isprocvar,need_conv_to_voidptr: Boolean;
|
||||||
procpointertype: tdef;
|
procpointertype: tdef;
|
||||||
hsym: tfieldvarsym;
|
hsym: tfieldvarsym;
|
||||||
begin
|
begin
|
||||||
@ -131,12 +131,17 @@ implementation
|
|||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
isprocvar:=(left.resultdef.typ=procvardef);
|
isprocvar:=(left.resultdef.typ=procvardef);
|
||||||
|
need_conv_to_voidptr:=
|
||||||
|
(m_tp_procvar in current_settings.modeswitches) or
|
||||||
|
(m_mac_procvar in current_settings.modeswitches);
|
||||||
|
|
||||||
if not isprocvar then
|
if not isprocvar then
|
||||||
begin
|
begin
|
||||||
if current_settings.x86memorymodel in x86_far_code_models then
|
if current_settings.x86memorymodel in x86_far_code_models then
|
||||||
begin
|
begin
|
||||||
left:=ctypeconvnode.create_proc_to_procvar(left);
|
left:=ctypeconvnode.create_proc_to_procvar(left);
|
||||||
|
if need_conv_to_voidptr then
|
||||||
|
include(ttypeconvnode(left).convnodeflags,tcnf_proc_2_procvar_2_voidpointer);
|
||||||
left.fileinfo:=fileinfo;
|
left.fileinfo:=fileinfo;
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
end
|
end
|
||||||
@ -145,8 +150,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ In tp procvar mode for methodpointers we need to load the proc field }
|
{ In tp procvar mode for methodpointers we need to load the proc field }
|
||||||
if (m_tp_procvar in current_settings.modeswitches) or
|
if need_conv_to_voidptr then
|
||||||
(m_mac_procvar in current_settings.modeswitches) then
|
|
||||||
begin
|
begin
|
||||||
if not tabstractprocdef(left.resultdef).is_addressonly then
|
if not tabstractprocdef(left.resultdef).is_addressonly then
|
||||||
begin
|
begin
|
||||||
|
@ -34,9 +34,14 @@ interface
|
|||||||
|
|
||||||
type
|
type
|
||||||
ttypeconvnodeflag = (
|
ttypeconvnodeflag = (
|
||||||
tcnf_dummyflag { todo: remove this, when the first real typeconvnode
|
{ the typeconvnode is a proc_2_procvar, generated internally by an
|
||||||
flag is added (this is just a dummy element, because
|
address operator, such as @proc, Addr(proc), Ofs(proc) or Seg(proc),
|
||||||
the enum cannot be empty) }
|
which is then going to be converted to a void pointer. Why does it
|
||||||
|
matter? Because, on i8086 far code memory models you're allowed to
|
||||||
|
take the address of a _near_ procedure as a void pointer (which the
|
||||||
|
@ operator does in TP mode), but not as a procvar (in that case the
|
||||||
|
procedure must be far). }
|
||||||
|
tcnf_proc_2_procvar_2_voidpointer
|
||||||
);
|
);
|
||||||
ttypeconvnodeflags = set of ttypeconvnodeflag;
|
ttypeconvnodeflags = set of ttypeconvnodeflag;
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ implementation
|
|||||||
var
|
var
|
||||||
hp : tnode;
|
hp : tnode;
|
||||||
hsym : tfieldvarsym;
|
hsym : tfieldvarsym;
|
||||||
isprocvar : boolean;
|
isprocvar,need_conv_to_voidptr: boolean;
|
||||||
procpointertype: tdef;
|
procpointertype: tdef;
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
@ -521,10 +521,15 @@ implementation
|
|||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
isprocvar:=(left.resultdef.typ=procvardef);
|
isprocvar:=(left.resultdef.typ=procvardef);
|
||||||
|
need_conv_to_voidptr:=
|
||||||
|
(m_tp_procvar in current_settings.modeswitches) or
|
||||||
|
(m_mac_procvar in current_settings.modeswitches);
|
||||||
|
|
||||||
if not isprocvar then
|
if not isprocvar then
|
||||||
begin
|
begin
|
||||||
left:=ctypeconvnode.create_proc_to_procvar(left);
|
left:=ctypeconvnode.create_proc_to_procvar(left);
|
||||||
|
if need_conv_to_voidptr then
|
||||||
|
include(ttypeconvnode(left).convnodeflags,tcnf_proc_2_procvar_2_voidpointer);
|
||||||
left.fileinfo:=fileinfo;
|
left.fileinfo:=fileinfo;
|
||||||
typecheckpass(left);
|
typecheckpass(left);
|
||||||
end;
|
end;
|
||||||
@ -532,8 +537,7 @@ implementation
|
|||||||
{ In tp procvar mode the result is always a voidpointer. Insert
|
{ In tp procvar mode the result is always a voidpointer. Insert
|
||||||
a typeconversion to voidpointer. For methodpointers we need
|
a typeconversion to voidpointer. For methodpointers we need
|
||||||
to load the proc field }
|
to load the proc field }
|
||||||
if (m_tp_procvar in current_settings.modeswitches) or
|
if need_conv_to_voidptr then
|
||||||
(m_mac_procvar in current_settings.modeswitches) then
|
|
||||||
begin
|
begin
|
||||||
if tabstractprocdef(left.resultdef).is_addressonly then
|
if tabstractprocdef(left.resultdef).is_addressonly then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user