03-18-06 01:53 AM
On 2006-03-17, Ben C <spamspam@spam.eggs> wrote:
> On 2006-03-17, Simon Elliott <> wrote:
>
> I use nm, grep for the capital Ts, filter that a bit with something,
> feed it to cscope -L -3, and look for empty strings coming back.
>
> Unused static functions will get you a compiler warning on gcc.
Oh and I forgot to mention, this will miss functions assigned to
variables and called indirectly. If you think there might be some of
those, it's a bit harder, but you can do something similar but with
cscope -L -0. Deciding if the indirected functions are actually called
is harder still...
There are such things as "dead code removing linkers", I think gcc may
have an option for this, that would probably be the most reliable thing
to use really.
[ Post a follow-up to this message ]
|