Sometimes, I have a large research (ugly) code base.
I’d like a tool to automatically and statically, simplify this code
base so that I can release the only interesting part and its dependencies.
Let’s say the code base has N functions; let’s say I consider only functions at
the first level layer of each module (not sub functions).
If N variants of the program are created, each variant missing only one of these functions,
then by compiling the software N times, it would be possible to discover unused functions
(the corresponding program variant does not compile).
Remove them, then iterate until a stable state has been reached.
Do we have tools to implement this easily?
Or, even better, can’t the compiler discover automatically all dead code and tell me about it
with some specific options?
Thanks a lot,