Sign in Join
Wiki copytemporary

IDE Window: Find Unused Units

Deutsch · English

IDE Dialog: Find unused units

How does it work

The function scans all used units of the current unit (all uses sections, not recursively) and checks if any interface definition of these units is mentioned in the current unit. It does no overload checks. It also checks if the used units has initialization/finalization sections.

The units used in the interface uses section are listed under 'Interfaces'. The units used in the implementation uses section are listed under 'Implementation'.

You can select a set of units and let the IDE remove them from the uses sections of the current unit.

Units with no initialization/finalization section have an icon with a book. It is safe to remove them.

Units with an initialization/implementation section have a battery like icon. You must decide if they are needed.

What is it good for

The compiler normally gives a hint if a unit is not used. But some units have an initialization section. For example the 'graphics' unit of the LCL registers a table of color names. The compiler therefore marks graphics as 'used' even though you might never use the color names. This dialog will show the difference and let the developer decide.

Limitations

How to reach this dialog

This dialog is available via source editor popup menu / Refactoring / Show unused units. You can also set a shortcut via the editor options / key mapping / Codetools commands / Remove unused units.

It is only available for pascal units.


From the Free Pascal wiki, page "IDE Window: Find Unused Units", as it stood on 2015-07-03 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.