* New 'do not execute' flag for notes and respective internal error triggering

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2022-11-24 21:16:47 +00:00 committed by FPK
parent 586a7d30ab
commit 1b43913408
4 changed files with 21 additions and 12 deletions

View File

@ -279,14 +279,11 @@ interface
nf_ignore_for_wpo, { we know that this loadvmtaddrnode cannot be used to construct a class instance } nf_ignore_for_wpo, { we know that this loadvmtaddrnode cannot be used to construct a class instance }
{ node is derived from generic parameter } { node is derived from generic parameter }
nf_generic_para nf_generic_para,
{ WARNING: there are now 32 elements in this type, and a set of this
type is written to the PPU. So before adding more elements,
either move some flags to specific nodes, or stream a normalset
to the ppu
}
{ internal flag to indicate that this node has been removed from the tree or must otherwise not be
execute. Running it through firstpass etc. will raise an internal error }
nf_do_not_execute
); );
tnodeflags = set of tnodeflag; tnodeflags = set of tnodeflag;
@ -777,7 +774,7 @@ implementation
ppufile.getset(tppuset5(localswitches)); ppufile.getset(tppuset5(localswitches));
verbosity:=ppufile.getlongint; verbosity:=ppufile.getlongint;
ppufile.getderef(resultdefderef); ppufile.getderef(resultdefderef);
ppufile.getset(tppuset4(flags)); ppufile.getset(tppuset5(flags));
{ updated by firstpass } { updated by firstpass }
expectloc:=LOC_INVALID; expectloc:=LOC_INVALID;
{ updated by secondpass } { updated by secondpass }
@ -792,7 +789,7 @@ implementation
ppufile.putset(tppuset5(localswitches)); ppufile.putset(tppuset5(localswitches));
ppufile.putlongint(verbosity); ppufile.putlongint(verbosity);
ppufile.putderef(resultdefderef); ppufile.putderef(resultdefderef);
ppufile.putset(tppuset4(flags)); ppufile.putset(tppuset5(flags));
end; end;
@ -1425,9 +1422,9 @@ begin
{ tvaroption must fit into a 4 byte set for speed reasons } { tvaroption must fit into a 4 byte set for speed reasons }
if ord(high(tvaroption))>31 then if ord(high(tvaroption))>31 then
internalerror(201110301); internalerror(201110301);
{ tnodeflags must fit into a 4 byte set for speed reasons } (* { tnodeflags must fit into a 4 byte set for speed reasons }
if ord(high(tnodeflags))>31 then if ord(high(tnodeflags))>31 then
internalerror(2014020701); internalerror(2014020701); *)
{$pop} {$pop}
end. end.

View File

@ -45,6 +45,7 @@ implementation
globtype,comphook, globtype,comphook,
globals, globals,
procinfo, procinfo,
verbose,
symdef symdef
{$ifdef extdebug} {$ifdef extdebug}
,verbose,htypechk ,verbose,htypechk
@ -157,6 +158,7 @@ implementation
begin begin
if (nf_pass1_done in p.flags) then if (nf_pass1_done in p.flags) then
exit; exit;
if not(nf_error in p.flags) then if not(nf_error in p.flags) then
begin begin
oldcodegenerror:=codegenerror; oldcodegenerror:=codegenerror;
@ -165,6 +167,11 @@ implementation
oldverbosity:=status.verbosity; oldverbosity:=status.verbosity;
codegenerror:=false; codegenerror:=false;
repeat repeat
{ The error flag takes precedence over the 'do not execute' flag,
as its assumed the node tree isn't tenable beyond this point }
if (nf_do_not_execute in p.flags) then
InternalError(2022112401);
{ checks make always a call } { checks make always a call }
if ([cs_check_range,cs_check_overflow,cs_check_stack] * current_settings.localswitches <> []) then if ([cs_check_range,cs_check_overflow,cs_check_stack] * current_settings.localswitches <> []) then
include(current_procinfo.flags,pi_do_call); include(current_procinfo.flags,pi_do_call);

View File

@ -189,6 +189,11 @@ implementation
internalerror(200208221); internalerror(200208221);
if not(nf_error in p.flags) then if not(nf_error in p.flags) then
begin begin
{ The error flag takes precedence over the 'do not execute' flag,
as its assumed the node tree isn't tenable beyond this point }
if (nf_do_not_execute in p.flags) then
InternalError(2022112402);
oldcodegenerror:=codegenerror; oldcodegenerror:=codegenerror;
oldlocalswitches:=current_settings.localswitches; oldlocalswitches:=current_settings.localswitches;
oldpos:=current_filepos; oldpos:=current_filepos;

View File

@ -48,7 +48,7 @@ const
CurrentPPUVersion = 208; CurrentPPUVersion = 208;
{ for any other changes to the ppu format, increase this version number { for any other changes to the ppu format, increase this version number
(it's a cardinal) } (it's a cardinal) }
CurrentPPULongVersion = 17; CurrentPPULongVersion = 18;
{ unit flags } { unit flags }
uf_big_endian = $000004; uf_big_endian = $000004;