|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article <62e3029a-2655-4b63-9511-d561acba7a89@
34g2000hsh.googlegroups.com>, julekmen@go2.pl 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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 1978) 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 ful---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:james.kanze@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 |
|
![]() |
| Outils de la discussion | |
|
|