We have a large C/C++ legacy source tree that has been around the block a few times. We expect there are a substantial number of methods no longer used. Is there a tool that can help us quickly identify the unused code?


At work, we use AQTime for any profiling needs. It comes with a static analysis tool, which should be what you need. However, if you don't need the other profilers or run on a platform or compiler not supported by AQTime, it is overkill, money-wise at least.

+5  A: 

You should get a good static code analyzer.

Look around here for suitable option.

  1. Is there any free C++ code coverage tool which is useful?
  2. What tools do you use for static code analysis?
  3. What is your favourite Code Coverage tool(s) (Free and non-free)

Also check out CTC++ Test Coverage Analyser

With these tools you list, and GCov below, do they do static analysis of the code and tell you with certainty that function are not called, or do they just monitor which functions are called during runs of the program?
+1  A: 

For GCC there is GCov.