* as a workaround for some compiler bug introduced during 3.1.1 the freeing of the management operator offset entry lists is moved to a nested procedure as that does not trigger the bug (even with -O2 or -O3)

git-svn-id: trunk@39711 -
This commit is contained in:
svenbarth 2018-09-04 20:20:07 +00:00
parent ba08bdc9b1
commit 92cce05f5f

View File

@ -1175,22 +1175,45 @@ implementation
destructor tabstractrecordsymtable.destroy;
{ for some reason a compiler built with 3.3.1 fails building the libxml2
package if the below define is not defined and thus the code snippet is
part of the destructor itself and not a nested procedure; until that bug
is fixed this is used as a workaround :/ }
{$define codegen_workaround}
{$ifdef codegen_workaround}
procedure free_mop_list(mop:tmanagementoperator);
var
i : longint;
begin
if assigned(mop_list[mop]) then
for i:=0 to mop_list[mop].count-1 do
dispose(pmanagementoperator_offset_entry(mop_list[mop][i]));
mop_list[mop].free;
end;
{$endif codegen_workaround}
var
mop : tmanagementoperator;
mopofs : pmanagementoperator_offset_entry;
{$ifndef codegen_workaround}
i : longint;
{$endif codegen_workaround}
begin
if refcount>1 then
exit;
{$ifdef llvm}
fllvmst.free;
{$endif llvm}
for mop in tmanagementoperator do
for mop:=low(tmanagementoperator) to high(tmanagementoperator) do
begin
{$ifdef codegen_workaround}
free_mop_list(mop);
{$else codegen_workaround}
if assigned(mop_list[mop]) then
for i:=0 to mop_list[mop].count-1 do
dispose(pmanagementoperator_offset_entry(mop_list[mop][i]));
mop_list[mop].free;
{$endif codegen_workaround}
end;
inherited destroy;
end;