Mail Archives: djgpp/1996/05/16/09:37:07
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 ;-).
- Raw text -