mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 13:19:12 +02:00
+ noreturn directive
git-svn-id: trunk@26003 -
This commit is contained in:
parent
039979fdcc
commit
1d4a4d0684
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -11504,6 +11504,7 @@ tests/test/tnoext4.pp svneol=native#text/plain
|
|||||||
tests/test/tnonlocalgoto1.pp svneol=native#text/pascal
|
tests/test/tnonlocalgoto1.pp svneol=native#text/pascal
|
||||||
tests/test/tnonlocalgoto2.pp svneol=native#text/pascal
|
tests/test/tnonlocalgoto2.pp svneol=native#text/pascal
|
||||||
tests/test/tnonlocalgoto3.pp svneol=native#text/pascal
|
tests/test/tnonlocalgoto3.pp svneol=native#text/pascal
|
||||||
|
tests/test/tnoreturn1.pp svneol=native#text/pascal
|
||||||
tests/test/tnostackframe.pp svneol=native#text/pascal
|
tests/test/tnostackframe.pp svneol=native#text/pascal
|
||||||
tests/test/tnostackframe2.pp svneol=native#text/pascal
|
tests/test/tnostackframe2.pp svneol=native#text/pascal
|
||||||
tests/test/tnostackframe3.pp svneol=native#text/pascal
|
tests/test/tnostackframe3.pp svneol=native#text/pascal
|
||||||
|
@ -3209,6 +3209,10 @@ implementation
|
|||||||
if po_varargs in procdefinition.procoptions then
|
if po_varargs in procdefinition.procoptions then
|
||||||
include(callnodeflags,cnf_uses_varargs);
|
include(callnodeflags,cnf_uses_varargs);
|
||||||
|
|
||||||
|
{ set the appropriate node flag if the call never returns }
|
||||||
|
if po_noreturn in procdefinition.procoptions then
|
||||||
|
include(callnodeflags,cnf_call_never_returns);
|
||||||
|
|
||||||
{ Change loading of array of const to varargs }
|
{ Change loading of array of const to varargs }
|
||||||
if assigned(left) and
|
if assigned(left) and
|
||||||
is_array_of_const(tparavarsym(procdefinition.paras[procdefinition.paras.count-1]).vardef) and
|
is_array_of_const(tparavarsym(procdefinition.paras[procdefinition.paras.count-1]).vardef) and
|
||||||
|
@ -2037,7 +2037,7 @@ type
|
|||||||
end;
|
end;
|
||||||
const
|
const
|
||||||
{Should contain the number of procedure directives we support.}
|
{Should contain the number of procedure directives we support.}
|
||||||
num_proc_directives=43;
|
num_proc_directives=44;
|
||||||
proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
|
proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
@ -2258,6 +2258,15 @@ const
|
|||||||
mutexclpocall : [pocall_internproc];
|
mutexclpocall : [pocall_internproc];
|
||||||
mutexclpotype : [];
|
mutexclpotype : [];
|
||||||
mutexclpo : []
|
mutexclpo : []
|
||||||
|
),(
|
||||||
|
idtok:_NORETURN;
|
||||||
|
pd_flags : [pd_implemen,pd_interface,pd_body,pd_notobjintf];
|
||||||
|
handler : nil;
|
||||||
|
pocall : pocall_none;
|
||||||
|
pooption : [po_noreturn];
|
||||||
|
mutexclpocall : [];
|
||||||
|
mutexclpotype : [potype_constructor,potype_destructor,potype_operator,potype_class_constructor,potype_class_destructor];
|
||||||
|
mutexclpo : [po_interrupt,po_virtualmethod,po_iocheck]
|
||||||
),(
|
),(
|
||||||
idtok:_NOSTACKFRAME;
|
idtok:_NOSTACKFRAME;
|
||||||
pd_flags : [pd_implemen,pd_body,pd_procvar,pd_notobjintf];
|
pd_flags : [pd_implemen,pd_body,pd_procvar,pd_notobjintf];
|
||||||
|
@ -352,7 +352,9 @@ type
|
|||||||
with a higher visibility on the JVM target }
|
with a higher visibility on the JVM target }
|
||||||
po_auto_raised_visibility,
|
po_auto_raised_visibility,
|
||||||
{ procedure is far (x86 only) }
|
{ procedure is far (x86 only) }
|
||||||
po_far
|
po_far,
|
||||||
|
{ the procedure never returns, this information is usefull for dfa }
|
||||||
|
po_noreturn
|
||||||
);
|
);
|
||||||
tprocoptions=set of tprocoption;
|
tprocoptions=set of tprocoption;
|
||||||
|
|
||||||
|
@ -224,6 +224,7 @@ type
|
|||||||
_MULTIPLY,
|
_MULTIPLY,
|
||||||
_MWPASCAL,
|
_MWPASCAL,
|
||||||
_NEGATIVE,
|
_NEGATIVE,
|
||||||
|
_NORETURN,
|
||||||
_NOTEQUAL,
|
_NOTEQUAL,
|
||||||
_OPERATOR,
|
_OPERATOR,
|
||||||
_OPTIONAL,
|
_OPTIONAL,
|
||||||
@ -540,6 +541,7 @@ const
|
|||||||
(str:'MULTIPLY' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
(str:'MULTIPLY' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
||||||
(str:'MWPASCAL' ;special:false;keyword:[m_none];op:NOTOKEN),
|
(str:'MWPASCAL' ;special:false;keyword:[m_none];op:NOTOKEN),
|
||||||
(str:'NEGATIVE' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
(str:'NEGATIVE' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
||||||
|
(str:'NORETURN' ;special:false;keyword:[m_none];op:NOTOKEN),
|
||||||
(str:'NOTEQUAL' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
(str:'NOTEQUAL' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
|
||||||
(str:'OPERATOR' ;special:false;keyword:[m_fpc];op:NOTOKEN),
|
(str:'OPERATOR' ;special:false;keyword:[m_fpc];op:NOTOKEN),
|
||||||
(str:'OPTIONAL' ;special:false;keyword:[m_none];op:NOTOKEN), { optional methods in an Objective-C protocol }
|
(str:'OPTIONAL' ;special:false;keyword:[m_none];op:NOTOKEN), { optional methods in an Objective-C protocol }
|
||||||
|
@ -1730,7 +1730,8 @@ const
|
|||||||
(mask:po_ignore_for_overload_resolution;str: 'Ignored for overload resolution'),
|
(mask:po_ignore_for_overload_resolution;str: 'Ignored for overload resolution'),
|
||||||
(mask:po_rtlproc; str: 'RTL procedure'),
|
(mask:po_rtlproc; str: 'RTL procedure'),
|
||||||
(mask:po_auto_raised_visibility; str: 'Visibility raised by compiler'),
|
(mask:po_auto_raised_visibility; str: 'Visibility raised by compiler'),
|
||||||
(mask:po_far; str: 'Far')
|
(mask:po_far; str: 'Far'),
|
||||||
|
(mask:po_noreturn; str: 'No return')
|
||||||
);
|
);
|
||||||
var
|
var
|
||||||
proctypeoption : tproctypeoption;
|
proctypeoption : tproctypeoption;
|
||||||
|
16
tests/test/tnoreturn1.pp
Normal file
16
tests/test/tnoreturn1.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ %OPT=-Sew -vw -Oodfa}
|
||||||
|
|
||||||
|
procedure do_halt;noreturn;
|
||||||
|
begin
|
||||||
|
halt(0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function f : longint;
|
||||||
|
begin
|
||||||
|
do_halt;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
f;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user