#Is there a compiler flag to tell me about dead code?

1 messages · Page 1 of 1 (latest)

hexed bay
#

Particularly in zig build test. I would like some way to tell what functions are not compiled and therefore untested.

crystal flicker
#

this will eventually be a compile error iirc

#

idk about currently tho

left scarab
#

There's no real way to do that

#

Because conditional compilation means you might have functions that are only used on certain platforms

hexed bay
#

That's not unsolvable though, right? It would be possible to see that the reason the dead code wasn't generated was that you weren't compiling for the platform it was used on and omit it from the report since that info is all known at compile time. I think there's a big conceptual difference between dead code because it's not used anywhere and dead code because it's not used here

tiny loom
#

atm, only applying to unused private functions

#

it seems that it was also going to apply to unused pub functions that were not reachable from outside the package in a library, but that was crossed out, probably because of some technical limitation