[Libguestfs] [PATCH] generator: Sort the structs.
Pino Toscano
ptoscano at redhat.com
Tue Jul 1 15:27:42 UTC 2014
On Tuesday 01 July 2014 16:16:18 Richard W.M. Jones wrote:
> Sort the structs when generating code. Since the structs are
> logically indepedent of each other, this should have no effect except
> to make generated files list the structs in a different order.
>
> However this also fixes the following build problem:
>
> File "convert_linux.ml", line 322, characters 43-50:
> Error: This expression has type G.stat = Guestfs.stat
> but an expression was expected of type G.dirent = Guestfs.dirent
>
> It turns out the OCaml bindings don't like the fact that we have
> two structs with a common field name (dirent.ino and stat.ino).
>
> In OCaml < 4.01, this means that any attempt to reference stat.ino
> would fail because dirent.ino appears second in the file, overriding
> stat.ino.
So that means that with such OCaml versions both the .ino members cannot
be used at the same time?
> In OCaml >= 4.01 the compiler now uses some disambiguation rules based
> on the known types to resolve this problem.
Patch seems good to me.
Thanks,
--
Pino Toscano
More information about the Libguestfs
mailing list