[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Demexp-dev] XDR file compilation issue

From: David MENTRE
Subject: Re: [Demexp-dev] XDR file compilation issue
Date: Sun, 17 Apr 2005 17:52:25 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Hello Thomas,

Thomas Petazzoni <address@hidden> writes:

>   enum { b = 1, c = 1 } mytype;

Ok, let's try to match above entry with the grammar (cf. §5.3 in RFC).

        definition *


          | "enum" identifier enum-body ";"

So your above "enum { b = 1, c = 1 } mytype;" is not matched by the
grammar. So I would said it is not valid.

You should write "enum mytype { b = 1, c = 1 } ;".

I suppose mytype is correctly defined for the following.

>   struct blabla {
>     enum mytype m;
>   };
>   struct toto {
>     struct blabla meuh;
>   };

        definition *


          | "struct" identifier struct-body ";"

                    ( declaration ";" )
                    ( declaration ";" )*

                        type-specifier identifier

                         | enum-type-spec

                             "enum" enum-body

                                        ( identifier "=" value )
                                        ( "," identifier "=" value )*

In the case we want do define the enum there. This is not the case in
your example.

Or, we consider we reuse an identifier.

                        | identifier

In that case, I think you're right. We should write "mytype" instead of
"enum mytype" and "blabla" instead of "struct blabla" in the struct

> First of all, I thought it was a bug of my RPC Generator. In fact, after
> reading RFC 1014 (, I think the problem
> is a laxism in the Ocaml RPC Generator : «struct blabla meuh» should not
> be allowed.

I think you're right within the context of a struct definition.

> The correct syntax seems to be :
>   struct blabla {
>     mytype m;
>   };

I agree.

> In this case, the «type-specifier» is simply «identifier», and it works.
> Similarly, one should write :
>   struct toto {
>     blabla meuh;
>   };


> I am not completely sure of this, since I'm not a BNF expert, but it
> seems to be confirmed by the example in section 6 of the RFC. In this
> example, a «union filetype» is defined, and then used directly as
> «filetype» in the definition of «struct file».

I'm not an expert myself but applying by hand the grammar seems to match
your example.

> The attached dpatch fixes the problem. The XDR file still compiles with
> ocamlrpcgen, and DemExp still compiles with it. And my RPC Generator
> also compiles it ! ;-)

Ok, patch queued (or more exactly, your next email ;). As long as the
patch doesn't request a change for ocamlrpcgen, is fine for me.

> If I'm right, it may be a good idea to report a bug to the developers of
> ocamlrpcgen to tell them that their RPC generator is too laxist.

You'd better contact Gerd Stolpman yourself (feel free to reuse part of
my email if necessary). You'll find his email at this end of his page:

I would suggest tell him to print a warning if a current XDR def matches
the too laxist definition.

pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A

reply via email to

[Prev in Thread] Current Thread [Next in Thread]