D-Programming-Language/dmd — pull request #2550 by WalterBright (2013-09-11 21:52:36+00:00)
Title: fix Issue 10441 - Static libraries too big

I have given up complaining about importing std.stdio (and others) and getting a vast object file of bloat from templates that were instantiated simply by the import, and decided it was a dmd problem. This change addresses it by not generating code from functions that were instantiated by templates from imports, if the standalone import instantiates those same templates.

This should also speed up compiles.

The semantic analysis is still done. In the future I'd like to address this by going "full lazy" on the semantic analysis of imports (currently it is done "full eager"). Such will also produce a big compile time speedup.

This change has a risk of my having missed cases, the symptom of which will be undefined symbols at link time.

This only deals with functions. If it works out, we can extend it to not generating data, either.