27

Does anyone know about a utility, that can automatically detect and remove unrequired units from the uses clause?

Preferably it ..

  • can be run against a unit and/or a project
  • is free and works with Delphi 2010

Thanks in advance.

Rene Knop
  • 1,788
  • 3
  • 15
  • 27
rhazell
  • 285
  • 1
  • 3
  • 5
  • 2
    Hmmm. How about searching for "[delphi] unused uses" on this site? :-) – Uli Gerhardt Feb 04 '10 at 14:31
  • 6
    I suppose you're right... please forgive me, this is my very first question posted on SO. However, the notion of posting a very specific question and getting a prompt, up-to-date response, from people willing to share is very compelling :) LONG LIVE DELPHI!!! (sorry I couldn't resist) – rhazell Feb 04 '10 at 14:48
  • No prob. I just wanted to give you a heads up. :-) – Uli Gerhardt Feb 04 '10 at 14:52

2 Answers2

30

Try using the "Uses Unit Cleaner" Wizard from CnPack you can download from here

alt text

Another option is use ICARUS.

ICARUS is a small subset of Pascal Analyzer. It parses Delphi or Borland Pascal source code and generates a list of unneeded unit references in your uses lists

Shaun Roselt
  • 1,650
  • 5
  • 18
  • 44
RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • Thanks, these both look very promising. Sidebar: It never ceases to amaze me how I've managed to miss little nuggets, like these... after using Delphi for more than a decade! – rhazell Feb 04 '10 at 14:43
  • The uses cleaner in cnPack is awesome, although I've found it a bit buggy when removing unused units (works great in finding them). Sometimes it removes some extra characters. – Alister Dec 15 '13 at 20:44
  • It's also worth checking out Pascal Analyser also from Peganza, which adds a lot of functionality beyond Icarus – Alister Sep 04 '14 at 10:17
  • ICARUS is no longer listed as a product at Peganza. – dummzeuch Oct 26 '18 at 07:32
  • 1
    _"Pascal Analyzer Lite replaces ICARUS, our free product for analysis of Delphi uses lists."_ – Martin Schneider Apr 10 '19 at 09:44
9

ICARUS from Peganza does something similar.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130