Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/rt/lifetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,8 @@ private
}
}

private immutable bool callStructDtorsDuringGC;

extern (C) void lifetime_init()
{
// this is run before static ctors, so it is safe to modify immutables
import rt.config;
string s = rt_configOption("callStructDtorsDuringGC");
if (s != null)
cast() callStructDtorsDuringGC = s[0] == '1' || s[0] == 'y' || s[0] == 'Y';
else
cast() callStructDtorsDuringGC = true;
}

/**
Expand Down Expand Up @@ -212,9 +203,6 @@ inout(TypeInfo) unqualify(inout(TypeInfo) cti) pure nothrow @nogc
// size used to store the TypeInfo at the end of an allocation for structs that have a destructor
size_t structTypeInfoSize(const TypeInfo ti) pure nothrow @nogc
{
if (!callStructDtorsDuringGC)
return 0;

if (ti && typeid(ti) is typeid(TypeInfo_Struct)) // avoid a complete dynamic type cast
{
auto sti = cast(TypeInfo_Struct)cast(void*)ti;
Expand Down Expand Up @@ -2590,7 +2578,6 @@ unittest
delete arr1;
assert(dtorCount == 7);

if (callStructDtorsDuringGC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove scoping/indentation, too. Later it will just confuse people why it is there sometimes, and sometimes not.

{
dtorCount = 0;
S1* s2 = new S1;
Expand Down Expand Up @@ -2624,7 +2611,6 @@ unittest
arr2.assumeSafeAppend;
assert(dtorCount == 4); // destructors run explicitely?

if (callStructDtorsDuringGC)
{
dtorCount = 0;
BlkInfo blkinf = GC.query(arr2.ptr);
Expand All @@ -2641,7 +2627,6 @@ unittest
S1[int] aa1;
aa1[0] = S1(0);
aa1[1] = S1(1);
if (callStructDtorsDuringGC)
{
dtorCount = 0;
aa1 = null;
Expand All @@ -2653,7 +2638,6 @@ unittest
aa2[S1(0)] = 0;
aa2[S1(1)] = 1;
aa2[S1(2)] = 2;
if (callStructDtorsDuringGC)
{
dtorCount = 0;
aa2 = null;
Expand All @@ -2664,7 +2648,6 @@ unittest
S1[2][int] aa3;
aa3[0] = [S1(0),S1(2)];
aa3[1] = [S1(1),S1(3)];
if (callStructDtorsDuringGC)
{
dtorCount = 0;
aa3 = null;
Expand Down Expand Up @@ -2712,9 +2695,6 @@ unittest
debug(SENTINEL) {} else
unittest
{
if (!callStructDtorsDuringGC)
return;

bool test(E)()
{
import core.exception;
Expand Down