From: "A.Appleyard" Organization: Materials Science Centre To: Eli Zaretskii , DJGPP AT delorie DOT com Date: Mon, 24 Feb 1997 15:50:44 GMT Subject: Re: How to find all references? Message-ID: <334FBF9568F@fs2.mt.umist.ac.uk> 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!