Thread overview
[Bug 161] GDC prevents backend from removing dead functions
Apr 08, 2015
Iain Buclaw
May 03, 2015
Iain Buclaw
May 03, 2015
Iain Buclaw
April 08, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=161

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Isn't this what LTO/strip is used for?

Actually, it's mark_needed in d-objfile.cc that forces it's write to objfile. It's needed for sure, otherwise phantom linker errors crop up in larger / heavy templated projects.

-- 
You are receiving this mail because:
You are watching all bug changes.


May 03, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=161

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This is the crux of the problem why we do what we do (snipped, shortened, and with added clarity from std.exception).

----
private void bailOut() { assert(false); }

public T enforce(T value)
{
    if (!value)
        bailOut();
    return value;
}
----

When compiling the module, 'private bailOut' is would be seen as unused, and so considered as a candidate for removal.  However, external modules that instantiate 'public enforce' would indirectly need bailOut to exist.

I am aware that the spec says that 'private' in D is equivalent to 'static' in C, but in practice, that it just doesn't work that way.

-- 
You are receiving this mail because:
You are watching all bug changes.


May 03, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=161

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Iain Buclaw from comment #2)
> 
> When compiling the module, 'private bailOut' is would be seen as unused, and so considered as a candidate for removal.  However, external modules that instantiate 'public enforce' would indirectly need bailOut to exist.
> 

Even if 'private bailOut' is not removed.  It still requires that TREE_PUBLIC be set on the symbol so that it is accessible at link-time.

-- 
You are receiving this mail because:
You are watching all bug changes.