mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 03:09:15 +02:00
* If a function can't be inline (contains an assembler block, etc) remove the po_inline flag from its procoptions.
git-svn-id: trunk@40223 -
This commit is contained in:
parent
8fba43609d
commit
95d18cd052
@ -93,7 +93,7 @@ implementation
|
|||||||
uses
|
uses
|
||||||
sysutils,
|
sysutils,
|
||||||
{ common }
|
{ common }
|
||||||
cutils,
|
cutils, cmsgs,
|
||||||
{ global }
|
{ global }
|
||||||
globtype,tokens,verbose,comphook,constexp,
|
globtype,tokens,verbose,comphook,constexp,
|
||||||
systems,cpubase,aasmbase,aasmtai,aasmdata,
|
systems,cpubase,aasmbase,aasmtai,aasmdata,
|
||||||
@ -138,6 +138,14 @@ implementation
|
|||||||
;
|
;
|
||||||
|
|
||||||
function checknodeinlining(procdef: tprocdef): boolean;
|
function checknodeinlining(procdef: tprocdef): boolean;
|
||||||
|
|
||||||
|
procedure _no_inline(const reason: TMsgStr);
|
||||||
|
begin
|
||||||
|
exclude(procdef.procoptions,po_inline);
|
||||||
|
Message1(parser_h_not_supported_for_inline,reason);
|
||||||
|
Message(parser_h_inlining_disabled);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
currpara : tparavarsym;
|
currpara : tparavarsym;
|
||||||
@ -150,26 +158,22 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
if pi_has_assembler_block in current_procinfo.flags then
|
if pi_has_assembler_block in current_procinfo.flags then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'assembler');
|
_no_inline('assembler');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if pi_has_global_goto in current_procinfo.flags then
|
if pi_has_global_goto in current_procinfo.flags then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'global goto');
|
_no_inline('global goto');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if pi_has_nested_exit in current_procinfo.flags then
|
if pi_has_nested_exit in current_procinfo.flags then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'nested exit');
|
_no_inline('nested exit');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if pi_calls_c_varargs in current_procinfo.flags then
|
if pi_calls_c_varargs in current_procinfo.flags then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'called C-style varargs functions');
|
_no_inline('called C-style varargs functions');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ the compiler cannot handle inherited in inlined subroutines because
|
{ the compiler cannot handle inherited in inlined subroutines because
|
||||||
@ -177,8 +181,7 @@ implementation
|
|||||||
is not available }
|
is not available }
|
||||||
if pi_has_inherited in current_procinfo.flags then
|
if pi_has_inherited in current_procinfo.flags then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'inherited');
|
_no_inline('inherited');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
for i:=0 to procdef.paras.count-1 do
|
for i:=0 to procdef.paras.count-1 do
|
||||||
@ -189,8 +192,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if (currpara.varspez in [vs_out,vs_var,vs_const,vs_constref]) then
|
if (currpara.varspez in [vs_out,vs_var,vs_const,vs_constref]) then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'formal parameter');
|
_no_inline('formal parameter');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -199,8 +201,7 @@ implementation
|
|||||||
if is_array_of_const(currpara.vardef) or
|
if is_array_of_const(currpara.vardef) or
|
||||||
is_variant_array(currpara.vardef) then
|
is_variant_array(currpara.vardef) then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'array of const');
|
_no_inline('array of const');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ open arrays might need re-basing of the index, i.e. if you pass
|
{ open arrays might need re-basing of the index, i.e. if you pass
|
||||||
@ -208,8 +209,7 @@ implementation
|
|||||||
if you directly inline it }
|
if you directly inline it }
|
||||||
if is_open_array(currpara.vardef) then
|
if is_open_array(currpara.vardef) then
|
||||||
begin
|
begin
|
||||||
Message1(parser_h_not_supported_for_inline,'open array');
|
_no_inline('open array');
|
||||||
Message(parser_h_inlining_disabled);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user