* give warning for disabling inline if assembler

is detected

git-svn-id: trunk@10473 -
This commit is contained in:
peter 2008-03-11 17:57:24 +00:00
parent 461c8fb09f
commit beb01e6e79
2 changed files with 37 additions and 42 deletions

View File

@ -347,31 +347,6 @@ implementation
end;
procedure check_inline_para(p:TObject;arg:pointer);
var
pd : tabstractprocdef absolute arg;
begin
if not(po_inline in pd.procoptions) or
(tsym(p).typ<>paravarsym) then
exit;
with tparavarsym(p) do
begin
case vardef.typ of
arraydef :
begin
if is_array_constructor(vardef) or
is_variant_array(vardef) then
begin
Message1(parser_w_not_supported_for_inline,'array of const');
Message(parser_w_inlining_disabled);
pd.proccalloption:=pocall_default;
end;
end;
end;
end;
end;
procedure set_addr_param_regable(p:TObject;arg:pointer);
begin
if (tsym(p).typ<>paravarsym) then
@ -1207,13 +1182,6 @@ begin
end;
procedure pd_inline(pd:tabstractprocdef);
begin
{ Check if there are parameters that can't be inlined }
pd.parast.SymList.ForEachCall(@check_inline_para,pd);
end;
procedure pd_internconst(pd:tabstractprocdef);
var v:Tconstexprint;
@ -1779,7 +1747,7 @@ const
),(
idtok:_INLINE;
pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
handler : @pd_inline;
handler : nil;
pocall : pocall_none;
pooption : [po_inline];
mutexclpocall : [];

View File

@ -1219,18 +1219,45 @@ implementation
begin
result := false;
if (pi_has_assembler_block in current_procinfo.flags) then
exit;
begin
Message1(parser_w_not_supported_for_inline,'assembler');
Message(parser_w_inlining_disabled);
exit;
end;
for i:=0 to procdef.paras.count-1 do
begin
currpara:=tparavarsym(procdef.paras[i]);
{ we can't handle formaldefs and special arrays (the latter may need a }
{ re-basing of the index, i.e. if you pass an array[1..10] as open array, }
{ you have to add 1 to all index operations if you directly inline it }
if ((currpara.varspez in [vs_out,vs_var,vs_const]) and
(currpara.vardef.typ=formaldef)) or
is_special_array(currpara.vardef) then
exit;
end;
case currpara.vardef.typ of
formaldef :
begin
if (currpara.varspez in [vs_out,vs_var,vs_const]) then
begin
Message1(parser_w_not_supported_for_inline,'formal parameter');
Message(parser_w_inlining_disabled);
exit;
end;
end;
arraydef :
begin
if is_array_constructor(currpara.vardef) or
is_variant_array(currpara.vardef) then
begin
Message1(parser_w_not_supported_for_inline,'array of const');
Message(parser_w_inlining_disabled);
exit;
end;
{ open arrays might need re-basing of the index, i.e. if you pass
an array[1..10] as open array, you have to add 1 to all index operations
if you directly inline it }
if is_open_array(currpara.vardef) then
begin
Message1(parser_w_not_supported_for_inline,'open array');
Message(parser_w_inlining_disabled);
exit;
end;
end;
end;
end;
result:=true;
end;