Date: Sat, 2 Jan 1999 00:50:05 -0600 From: Dan Nelson <dnelson@emsphone.com> To: Joe Shevland <J_Shevland@TurnAround.com.au> Cc: Greg Lehey <grog@lemis.com>, FreeBSD Hackers <hackers@FreeBSD.ORG> Subject: Re: Finding unused functions Message-ID: <19990102005004.A93495@dan.emsphone.com> In-Reply-To: <368D9D58.EDD30BA7@TurnAround.com.au>; from "Joe Shevland" on Sat Jan 2 15:15:20 GMT 1999 References: <19990102142213.J48076@freebie.lemis.com> <368D9D58.EDD30BA7@TurnAround.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 02), Joe Shevland said: > Greg Lehey wrote: > > It's occurred to me that after rewriting some code, I have some > > unused functions in a program. Are there any good automatic ways > > to find out what they are, something like the warnings you get from > > cc about unused variables? > > 'lint' should do the trick I think. It'll return something like: > > doNothing defined( foo.c(8) ), but never used > > You'll get a _lot_ more than that though probably :) I haven't used > lint really, and it looks as though unused variables return a similar > message; may be a fair bit to sift through. I don't think the lint libraries are built on FreeBSD though. What I usually do is always make my functions static; that way gcc will complain if they're not referenced. This only works on one-file programs though. You could probably do some "nm" parsing on your object files; complain if there are any functions with a 'T' line but no 'U' lines. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990102005004.A93495>