Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Tool to delete unneeded methods/enums, etc.

Reply
Thread Tools

Tool to delete unneeded methods/enums, etc.

 
 
Julek
Guest
Posts: n/a
 
      06-30-2008
Hi,
is there a tool which parses cpp and h files, finds unused things, and
deletes them from code? For example unused methods, enums, enum
values, defines... It doesn't have to be sophisticated (it doesn't
have to check, that ClassA::funX is used somewhere, but ClassB::funX
is not used anywhere, so we can delete only ClassB::funX).

Thanks in advance!
 
Reply With Quote
 
 
 
 
Jerry Coffin
Guest
Posts: n/a
 
      06-30-2008
In article <62e3029a-2655-4b63-9511-d561acba7a89@
34g2000hsh.googlegroups.com>, says...
> Hi,
> is there a tool which parses cpp and h files, finds unused things, and
> deletes them from code?


Yes. It's called an "optimizing compiler".

> For example unused methods, enums, enum
> values, defines... It doesn't have to be sophisticated (it doesn't
> have to check, that ClassA::funX is used somewhere, but ClassB::funX
> is not used anywhere, so we can delete only ClassB::funX).


Realistically, getting something like this to work correctly would be
quite difficult -- little short of a full-blown compiler could really do
the job correctly.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      06-30-2008
On Jun 30, 5:57 pm, Jerry Coffin <jcof...@taeus.com> wrote:
> In article <62e3029a-2655-4b63-9511-d561acba7a89@
> 34g2000hsh.googlegroups.com>, julek...@go2.pl says...


> > is there a tool which parses cpp and h files, finds unused
> > things, and deletes them from code?


> Yes. It's called an "optimizing compiler".


> > For example unused methods, enums, enum
> > values, defines... It doesn't have to be sophisticated (it doesn't
> > have to check, that ClassA::funX is used somewhere, but ClassB::funX
> > is not used anywhere, so we can delete only ClassB::funX).


> Realistically, getting something like this to work correctly would be
> quite difficult -- little short of a full-blown compiler could really do
> the job correctly.


FWIW: one Fortran compiler I used (around 197 did output a
message when it suppressed a line because it couldn't be
reached, or otherwise did something which had no effect. This
could actually be very helpful---in one case, I remember getting
messages to the effect:
line x: removed, because variable YO is never used.
line y: variable Y0 used without being set.
I'm not sure about the relative utility of such a thing in C++,
however. The preprocessor makes it a bit awkward: what if I
don't use the enum E (defined in some header); maybe some other
code in another application does use it.

--
James Kanze (GABI Software) email:
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unneeded/unwanted padlock symbol caseyatbat16 General Computer Support 1 12-31-2009 12:40 AM
Why does Thunderbird ask me for unneeded password? Johann Fu Firefox 4 01-25-2007 06:31 PM
Great way to recycle that old unneeded computer!! SeniorARK Computer Support 2 08-20-2006 11:36 AM
Large unneeded file? Lee Davison Computer Support 5 10-02-2005 05:42 PM
making an unneeded post back =?Utf-8?B?S2VubnkgTS4=?= ASP .Net 2 01-25-2005 07:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57