Re: Tool to detect unused units

From: Franz-Leo Chomse (franz-leo.chomse_at_samac.de)
Date: 06/14/04


Date: Mon, 14 Jun 2004 13:19:12 +0200


>
>Here is a resource page about this issue:
> http://www.brenemanlabs.com/Uses.htm
>
>There are three tools listed near the bottom of that page.

Caveat.

There are cases in which these tools mark needed units as unused.
These tools define "unused" as not needed for compilation, but there
are cases in which this is not equivalent as "not needed for the
application"

1. Secondary usage of uses clause.

  This is the case with the uses clause in the project file. The uses
  clause is used by the IDE to determine the units, datamodules and
forms belonging to the project. Removing "unused" units will remove
 entries from the unit and forms list of the IDE

2. Indirect usage

  In this case contents of the unit is not used directly, but via a
  ancestor type or by using the factory or builder pattern.

  You need to be careful by any unit which has an used initialization
 package or an interface section only containing

  "this section intentionally left blank"

3. IDE interference

To assure that all class definitions needed for the streaming support
of the IDE (*.DFM or *.XFM) the IDE sometimes adds the units
containing parts of a complete hierarchy stream into to uses clause
of the interface part of a unit containing a form or data module
descendant. In this case removed "unused" units are forced back again.

If a unit has been moved to the implementation section, this will
trigger an compilation error later on

Regards from Germany

Franz-Leo
.



Relevant Pages

  • My list D2007 annoyances/todos I would like to see resolved in D2008
    ... If someone of these is just product of using the IDE wrongly I hope someone will point me into right direction, and sorry of my bad English... ... from uses clause IDE just can't find it. ... have way to sort with compare function definer as ... D2007 will mess up my project files uses ...
    (borland.public.delphi.non-technical)
  • Re: Dont use the "use" clause
    ... The use clause is barred by coding standards for a good reason, ... don't think it's necessarily name collisions that drive this rule. ... And if you need to see the declaration, ... > IDE should have "go to declaration" button. ...
    (comp.lang.ada)
  • Re: Please please please fix the IDE
    ... but I think that the OPTION STRICT setting in the IDE ... and that the compiler was getting its reference from one place ... > class and the OPTION clause is not generated. ...
    (microsoft.public.dotnet.general)
  • Re: Sorry, but not happy with D2007
    ... Surely the basic problem is that one "uses" clause is serving two ... Add a second "references" clause that is maintained by the ... In this scenario the IDE could even give the user the option: ... "Unit XXX is no longer referenced by any components on the form design. ...
    (borland.public.delphi.non-technical)
  • Re: From the LuxAsm list.
    ... > create an IDE, but would create a LuxAsm mode for emacs. ... only a user interface thing... ... accessed via a command-line interface _separately_ and _independently_ to ... LuxAsm will operate in the same exact method _except_ simply that the "user ...
    (alt.lang.asm)