Date: Mon, 24 Feb 1997 15:46:46 +0200 (IST) From: Eli Zaretskii To: "A.Appleyard" cc: DJGPP AT delorie DOT com Subject: Re: How to find all references? In-Reply-To: <331556E34ED@fs2.mt.umist.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 24 Feb 1997, A.Appleyard wrote: > -Wall gets djgpp to warn about unused variables inside functions. Only if you use -O or -O2, I think. Even if I am wrong, using optimization switches makes gcc warn about more unused stuff, so try it. > So, how to find all unused zero-level variables and ordinary functions and > class-member functions? 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? > It would be useful if the linker had an option to warn of all unused > references. If it could, then you would be able to find out with NM; the linker doesn't know anything that NM doesn't. > (1) Where among the source forms of the assembler and linker, or elsewhere, > is a description of the internal format of a djgpp *.O file?, so I can write > my own program to read a set of *.O files and list all references found in > them and which of them are unused. See above: if the info is inside the *.o files, NM would have found it. > (2) Is there a specific `demangle' function anywhere in djgpp? I.e. e.g. int > demangle(char*x,char*y); which puts into y a demangled form of the name in x. I think `cxxfilt' is the program which does that, no? If not, then there's a function that you can pull out of the GDB sources; search for `demangle'.