Date: Thu, 16 May 1996 16:26:50 +0200 (IST) From: Eli Zaretskii To: "A.Appleyard" Cc: DJGPP AT delorie DOT com Subject: Re: Unused functions In-Reply-To: <2D1D787C03@fs2.mt.umist.ac.uk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 16 May 1996, A.Appleyard wrote: > A.Appleyard wrote wanting djgpp's linker to be able to say which entry points > are (1) only used within the same file, so he can declare them `static', (2) > not used at all, so he can delete them. [snip] > how to easily find unused functions and unused global-level declarations? > Dividing the source form into infinity tiny files is too fiddly and awkward. Then how about just grep'ping through the sources? You could create a file with the names of all the functions defined by your program then call fgrep to search for these names. If all you find for a certain function is just its declaration and definition, that function is not used. You can also use grep (or sed or awk) to look for a regular expression that describes a function call and compare the results with the list of declared functions. GCC has a switch that causes it to output a list of all the functions declared by a source file. (Finding that switch in the GCC docs is left as an excercise to the interested readers ;-).