Identifying Unused Functions in C/C++

JavaMan picture JavaMan · May 24, 2012 · Viewed 13.8k times · Source

Possible Duplicate:
Finding “dead code” in a large C++ legacy application

My project has a lots of C source files each with a lots of global functions. Many of these are no longer referenced by any caller at all. Is there a simple way to identify which of these functions are not referenced by anyone at all?

The map file generated by VC seems to be useful. But I am not sure exactly how/when a function name is listed in the map file.

Answer

Brady picture Brady · May 24, 2012

You can use CCCC (free, open source) which gives you lots of metrics about your program. Another option would be Coverity (not free).

This question may be a duplicate of this one: Dead code detection in legacy C/C++ project