[fpc-devel] Improve error message for #0005942: fpc gives Illegal unit name for 8 character unit name conflict

Michalis Kamburelis michalis.kambi at gmail.com
Mon Feb 25 01:04:36 CET 2008


Hi

See this bug report:
[http://bugs.freepascal.org/bug_view_page.php?bug_id=5942], with
resolution "no change required". The result is the same still in FPC
2.3.1. I understand that the behavior should be kept as is, for
compatibility with TP and/or Delphi and filesystems with 8.3 filenames.

But the error message is so unclear that it makes you "bang your head
into the wall" when searching the problem :) --- error message speaks
about "Error: Illegal unit name: TestUnit", not indicating anywhere that
actually the problematic identifier is "TestUnitBla". When the TestUnit
interface is large, it's almost impossible to realize that this error
message is not related at all to "unit TestUnit;" declaration, it's only
related to "uses TestUnitBla;". (And the cause may be simply that you
forgot to add -Fu with path where TestUnitBla.pas resides.)

Even compiling with -va doesn't indicate anywhere that the problem is
with "TestUnitBla".

So, maybe at least improve error message to
  Error: Illegal unit name: TestUnit, expected TestUnitBla
This way it's clear that the problem is related to "TestUnitBla"
identifier, so it's more clear that TestUnit.pas is mistakenly picked up
as the source code for TestUnitBla.

Michalis



More information about the fpc-devel mailing list