[Lazarus] {$warn 5023 off: No warning about unused units}

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Apr 7 10:24:20 CEST 2016


On Wed, 6 Apr 2016 22:53:43 +0100
Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:

>[...]
> I see the same thing here with Lazarus v1.7. It is annoying for the SCM,
> but I think I figured out the reasoning for that line. Lazarus packages
> have somewhere a setting that says the unit managing the package must
> (or mustn't) be added to the program using that package. I guess it
> helps with forcing FPC to compile all units in question. I always delete
> that, as I like my uses clause clean.

You are confusing things here.
A package needs a unit, that has a uses clause to let the compiler
compile all units of the package. A design time package also needs to
register its Register procedures.
By default this is done by an auto generated unit. You can do this
with an unit of your own if you prefer.
This unit can also be added automatically to the program, to make sure
that all initialization sections of the package are called.
This is what you mean with "the unit managing the package must (or
mustn't) be added to the program using that package". By default
this is not done and this setting has nothing to do whether the unit is
compiled aka the $warn.

 
>[...]
> Project templates and macros in settings have simplified my life a lot.
> My hard drives have plenty of space for non-shared [between projects]
> compiled units too. 

Sharing ppu can be done easily with macros too and packages can
compile ppu for each project as well. You are missing the point of
packages.
The purpose of packages is to make sharing code easier by separating
the compilation of program and package sources. For example you can add,
rename directories in a package without affecting all programs. You can
play around with compiler flags in your program with less worrying that
packages are affected.
Using macros requires good knowledge of every package you use. As far
as I know you, Graeme, created or maintain all packages you use. In that
case packages are indeed just shared directories of your own sources
and macros might be the better solution.


> Lazarus simply has too many "automated functionality" these days that simply annoy.

... and always lacking this particular feature I need. ;)

Mattias




More information about the Lazarus mailing list