On Aug 1, 2:24 pm, joseph cook <joec...@gmail.comwrote:
On Aug 1, 7:45 am, sanjay <sanjay.ragh...@gmail.comwrote:
just to make the requirement more clear..
Following has been taken from coverity help which does have DEADCode
checker:
"The DEADCODE checker finds many instances of code that can never be
reached due to branches whose condition will always evaluate the same
way whenever the program is executed. This checker does not warn about
function-level dead code such as static functions which are never
called."
so here the requirement is to actually detect the code that is never
called. i think coverity/similar tools wont be of help here...
the reason i am looking for a tool is because the application is
pretty huge and includes hundreds of cpp files. Also the files have
been added since long.. so there will surely be lot of code that is
not used any more and could be removed..
I'm sorry, what you ask is impossible. No static analysis
could tell you which code may or may not be called during
execution of the program.
Yes and no. If the function is never referenced, it won't be
called. One simple solution for starters is to put each
function in a separate source file in a library, and see which
ones the linker picks up.
Of course, with virtual functions, it's somewhat harder. But
not always impossible.
You might as well as for a static analysis tool that tells you
whether a program will complete or not.
And... It's usually considered impossible in the general case,
but there are lots of special cases where it can be done.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34