Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2023-01

Incorrect hint (5023) "unit not used", if unit is only used in a conditional compiler expression (like: {$IF ..})

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Consider the follwoing program:
===
program test;

uses
  Version;
begin
  {$if TheVersion >= 1}
  writeln('Version 1 or higher');
  {$else}
  writeln('Version < 1');
  {$endif}
end.
===
unit version;
interface
const
  TheVersion = 1;
implementation

end.
===
Compile with -vh
You get the hint: Unit "version" not used in test

This is obviously not true, without the unit version, the program won't compile.

Should I report this as a bug?

Bart

Reply by email

Michael Van Canneyt
to Bart
Bart wrote 31 lines
Consider the follwoing program: === program test; uses Version; begin {$if TheVersion >= 1} writeln('Version 1 or higher'); {$else} writeln('Version < 1'); {$endif} end. === unit version; interface const TheVersion = 1; implementation end. === Compile with -vh You get the hint: Unit "version" not used in test This is obviously not true, without the unit version, the program won't compile. Should I report this as a bug?

Yes.

Michael.

Reply by email

J. Gareth Moreton
to Bart: Consider the follwoing program: === program test; uses Version; begin {$if TheVersion >=…

In my opinion, yes, report this as a bug.  Sure, it's what I'd consider "low priority" since it's just an incorrect informative hint rather than something critical, but it's a bug nonetheless.

Kit

Bart wrote 32 lines
Consider the follwoing program: === program test; uses Version; begin {$if TheVersion >= 1} writeln('Version 1 or higher'); {$else} writeln('Version < 1'); {$endif} end. === unit version; interface const TheVersion = 1; implementation end. === Compile with -vh You get the hint: Unit "version" not used in test This is obviously not true, without the unit version, the program won't compile. Should I report this as a bug?

Reply by email