|
@@ -88,7 +88,7 @@ interface
|
|
function det_resulttype:tnode;override;
|
|
function det_resulttype:tnode;override;
|
|
function docompare(p: tnode): boolean; override;
|
|
function docompare(p: tnode): boolean; override;
|
|
procedure force_type(tt:ttype);
|
|
procedure force_type(tt:ttype);
|
|
- procedure insert_typeconvs(iscvarargs: boolean);
|
|
|
|
|
|
+ procedure insert_typeconvs;
|
|
end;
|
|
end;
|
|
tarrayconstructornodeclass = class of tarrayconstructornode;
|
|
tarrayconstructornodeclass = class of tarrayconstructornode;
|
|
|
|
|
|
@@ -940,14 +940,12 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- procedure tarrayconstructornode.insert_typeconvs(iscvarargs: boolean);
|
|
|
|
|
|
+ procedure tarrayconstructornode.insert_typeconvs;
|
|
var
|
|
var
|
|
hp : tarrayconstructornode;
|
|
hp : tarrayconstructornode;
|
|
dovariant : boolean;
|
|
dovariant : boolean;
|
|
begin
|
|
begin
|
|
- if (iscvarargs) then
|
|
|
|
- include(flags,nf_cvarargs);
|
|
|
|
- dovariant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resulttype.def).arrayoptions) or iscvarargs;
|
|
|
|
|
|
+ dovariant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resulttype.def).arrayoptions);
|
|
{ only pass left tree, right tree contains next construct if any }
|
|
{ only pass left tree, right tree contains next construct if any }
|
|
if assigned(left) then
|
|
if assigned(left) then
|
|
begin
|
|
begin
|
|
@@ -957,73 +955,8 @@ implementation
|
|
resulttypepass(hp.left);
|
|
resulttypepass(hp.left);
|
|
{ Insert typeconvs for array of const }
|
|
{ Insert typeconvs for array of const }
|
|
if dovariant then
|
|
if dovariant then
|
|
- begin
|
|
|
|
- if not(iscvarargs) and
|
|
|
|
- (hp.left.nodetype=stringconstn) then
|
|
|
|
- hp.left:=ctypeconvnode.create_internal(hp.left,cansistringtype)
|
|
|
|
- else
|
|
|
|
- case hp.left.resulttype.def.deftype of
|
|
|
|
- enumdef :
|
|
|
|
- hp.left:=ctypeconvnode.create_internal(hp.left,s32inttype);
|
|
|
|
- arraydef :
|
|
|
|
- begin
|
|
|
|
- if is_chararray(hp.left.resulttype.def) then
|
|
|
|
- hp.left:=ctypeconvnode.create_internal(hp.left,charpointertype)
|
|
|
|
- else
|
|
|
|
- if is_widechararray(hp.left.resulttype.def) then
|
|
|
|
- hp.left:=ctypeconvnode.create_internal(hp.left,widecharpointertype)
|
|
|
|
- else
|
|
|
|
- CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
|
|
|
|
- end;
|
|
|
|
- orddef :
|
|
|
|
- begin
|
|
|
|
- if is_integer(hp.left.resulttype.def) and
|
|
|
|
- not(is_64bitint(hp.left.resulttype.def)) then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,s32inttype)
|
|
|
|
- else if is_void(hp.left.resulttype.def) then
|
|
|
|
- CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename)
|
|
|
|
- else if iscvarargs and
|
|
|
|
- is_currency(hp.left.resulttype.def) then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,s64floattype);
|
|
|
|
- end;
|
|
|
|
- floatdef :
|
|
|
|
- if not(iscvarargs) then
|
|
|
|
- begin
|
|
|
|
- if not(is_currency(hp.left.resulttype.def)) then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- if is_constrealnode(hp.left) and
|
|
|
|
- not(nf_explicit in hp.left.flags) then
|
|
|
|
- MessagePos(hp.left.fileinfo,type_w_double_c_varargs);
|
|
|
|
- if (tfloatdef(hp.left.resulttype.def).typ in [{$ifndef x86_64}s32real,{$endif}s64currency]) or
|
|
|
|
- (is_constrealnode(hp.left) and
|
|
|
|
- not(nf_explicit in hp.left.flags)) then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,s64floattype);
|
|
|
|
- end;
|
|
|
|
- procvardef :
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
|
|
|
|
- stringdef:
|
|
|
|
- if iscvarargs then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,charpointertype);
|
|
|
|
- variantdef:
|
|
|
|
- if iscvarargs then
|
|
|
|
- CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
|
|
|
|
- pointerdef:
|
|
|
|
- ;
|
|
|
|
- classrefdef:
|
|
|
|
- if iscvarargs then
|
|
|
|
- hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
|
|
|
|
- objectdef :
|
|
|
|
- if iscvarargs or
|
|
|
|
- is_object(hp.left.resulttype.def) then
|
|
|
|
- CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
|
|
|
|
- else
|
|
|
|
- CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- resulttypepass(hp.left);
|
|
|
|
|
|
+ { at this time C varargs are no longer an arrayconstructornode }
|
|
|
|
+ insert_varargstypeconv(hp.left,false);
|
|
hp:=tarrayconstructornode(hp.right);
|
|
hp:=tarrayconstructornode(hp.right);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1042,9 +975,7 @@ implementation
|
|
resulttypepassed already }
|
|
resulttypepassed already }
|
|
if assigned(left) then
|
|
if assigned(left) then
|
|
begin
|
|
begin
|
|
- { in case of C varargs, insert_typeconvs has already been called }
|
|
|
|
- if not(nf_cvarargs in flags) then
|
|
|
|
- insert_typeconvs(false);
|
|
|
|
|
|
+ insert_typeconvs;
|
|
{ call firstpass for all nodes }
|
|
{ call firstpass for all nodes }
|
|
hp:=self;
|
|
hp:=self;
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|