[PATCH wayland] scanner: server-side also emit SINCE macros for requests

Pekka Paalanen ppaalanen at gmail.com
Wed Oct 14 01:52:36 PDT 2015


On Wed, 14 Oct 2015 10:32:36 +0300
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:

> 2015-10-14 4:06 GMT+03:00 Jonas Ã…dahl <jadahl at gmail.com>:
> > On Tue, Oct 13, 2015 at 04:18:19PM -0700, Bryce Harrington wrote:
> >> On Fri, Oct 09, 2015 at 10:07:48PM +0200, David FORT wrote:
> >> > Server-side we need to know the versions for destructor requests.
> >> >
> >> > Signed-off-by: David FORT <contact at hardening-consulting.com>
> >>
> >> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
> >>
> >> > ---
> >> >  src/scanner.c | 1 +
> >> >  1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/src/scanner.c b/src/scanner.c
> >> > index f456aa5..406ba82 100644
> >> > --- a/src/scanner.c
> >> > +++ b/src/scanner.c
> >> > @@ -1266,6 +1266,7 @@ emit_header(struct protocol *protocol, enum side side)
> >> >                     emit_structs(&i->request_list, i, side);
> >> >                     emit_opcodes(&i->event_list, i);
> >> >                     emit_opcode_versions(&i->event_list, i);
> >> > +                   emit_opcode_versions(&i->request_list, i);
> >
> > This will cause compilation error when an event and a request in the
> > same interface has the same name. Do we have that restriction already?
> 
> That sounds real confusing. If we don't, we should have it, imho.

We kind of sort of may have it...

See this made up xml:

<protocol name="dupe">

  <interface name="stupid" version="2">
    <request name="dupp" />
    <event name="dummy">
      <description summary="bump the opcode" />
    </event>
    <event name="dupp" since="2" />
  </interface>

</protocol>

This will already conflict without any "since" #definitions if both
client and server header are included in the same compilation unit,
because server header has

#define STUPID_DUPP	1

and client header has

#define STUPID_DUPP	0

This is a far-fetched example, but I think it shows that we really
should not have requests and events of the same name.

I would propose the following:

1. Patch wayland-scanner to reject protocols where an interface has
   both a request and an event with the same name.
2. Wait for a stable Wayland release.
3. Start relying on never to have a request and an event with the same name.

This is overly cautious, but I think it is possible people have got
away with using a same name, and we should know if anyone wants to
complain while we have a chance to back out.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151014/ed3952c9/attachment.sig>


More information about the wayland-devel mailing list