This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

is this GNAT error message confusing or am I confused or both?


The following error message has four occurences in
the GNAT sources. It has puzzled me several times.
I think it is really hard to understand because of
its "referential structure",
This is an example message printed by GNAT:

zx.adb:10:07: invalid prefix in selected component "X"

Maybe I'm just not familiar enough with the compiler writers'
point of view (or with Enlish language). A first question is,
what does "in" refer to? My current interpretation of the
message is that X is a prefix, then there is a thing termed
"component" and X is used as a prefix to the thing.
That is
  X     .Y
  prefix.component
(Have you thought otherwise? :-)
Is that really a "prefix in", not a "prefix to"?

When I first saw this message I was mislead, I think.
I was wondering where there was a prefix in component "X",
i.e., (in (component X)), not ((in component) X) or
(in component): and the invalid prefix is: "X".

I was asking myself, is there a prefix of the
name "X", not of some "Z.X", that denotes a component?
And what is invalid about it (the X, not the Z)?

This is the example from which the above message is produced.

procedure zx is

   package Z is
      Y: Natural;
   end Z;

subtype X is Natural;

begin
   if X.Y /= 0 then
      null;
   end if;
end zx;

For me,
 x in attr "B"
is parenthesized as
 x in (attr "B")
which is not the way to read the above error message,
because "selected component" is not an attribute of "X",
I think. Is this right? Should the message text be changed
then?

Consider the message,

invalid bucket in selected water "HasHoles" ;-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]