Mail Archives: djgpp/1997/02/24/10:59:13
A.Appleyard asked "how to find unused global variables and functions in a
big multi-file program"?
Eli Zaretski replied:-
> ... using optimization switches makes gcc warn about more unused stuff, so
> try it.
I tried this:-
redir -o ++ -e + gcc main.cc display.cc macros.cc keyf.cc em.cc cc.cc zip.cc
-lpc -O2 -Wall (as all one line)
It gave 38 warnings of the type "variable `class line * J' might be
clobbered by `longjmp' or `vfork'" and 2 of the type "`int m' might be used
uninitialized in this function". I did this before, and examination of my
logic showed that the compiler's fears were unjustified.
Eli Zaretski replied:-
> How about grep: can you look at all the places the variables and functions
> are mentioned, then see whether any of them is a function call (for a
> function) or if a variable is getting a value?
But I use functions and variables in hundreds of places!
- Raw text -