Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] finding dead code in C projects



I'm wondering if anyone has success stories about finding dead code in
large (C) projects?

There are discussions on how to use the linker [1] and/or the GNU compiler
[2] to find dead code.  However, it appears (I do not know C programming)
the best you can do is have that dead code not compiled into the binary.  I
want to be able to find dead code that should be removed from the source.

I've found some projects that deal with C++ code but they don't do C

I've found some projects (e.g. http://www.cs.umd.edu/~jfoster/cqual/) that
deal with C, but they have slightly different capabilities.

And I've found some projects (e.g. CScope http://cscope.sourceforge.net/)
that might do what I want, but I'm not sure.

It looks like this perl code by Andrew Tridgell might do what I want
http://www.samba.org/ftp/unpacked/junkcode/findstatic.pl

Btw, my investigation reveals an interesting call graph generator called
Egypt. http://www.gson.org/egypt/

[1]
http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/
[2]
http://stackoverflow.com/questions/4195494/using-gcc-to-find-unreachable-functions-dead-code

Greg Rundlett



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org