Reputation: 13408
I'm doing some refactoring in a project using Qt with Visual Studio 2008, and I'd like to know if there's a simple way to find the functions and methods that are never called?
Upvotes: 6
Views: 2914
Reputation: 7939
I've always preferred "grep", but that may be a bit "old-school".
Visual Studio will build a call-graph for you that is helpful but not 100% reliable.
Another alternative is comment out the function and see if the project will still link.
Upvotes: 2
Reputation: 7448
Is there a chance to build this Qt Project using gcc? If so, you could use gcov. It tells you all methods which were called during execution. Then you could use ctags to create a list of all methods available. From these two sets you could find those, not being called.
Of cause the application should run long enough under gcov for delivering more or less complete list of used functions.
(I guess there is an easier way using linker or a compiler switch. :-))
Upvotes: 1
Reputation: 3785
You can try a static code analysis tool, like http://en.wikipedia.org/wiki/Cppcheck
Upvotes: 10
Reputation: 2678
A -Wall in your compilation options should do it. (Or -Wunused-function). Check the compilator options in VS.
Upvotes: 4