[PATCH wayland 2/2] scanner: support "since" attribute for enum entries
Peter Hutterer
peter.hutterer at who-t.net
Thu Jan 12 00:14:36 UTC 2017
On Wed, Jan 11, 2017 at 07:14:45AM -0800, Yong Bakos wrote:
> Hi Peter,
>
> > On Jan 9, 2017, at 7:27 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> >
> > This was already in the DTD but not supported by the scanner.
> >
> > The request/event parsing have an additional check that "since" cannot be <
> > interface version. This is missing here. For requests/events we can rely on
> > the xml containing the required "since" attributes already. enums don't have
> > those, so our default version of 1 for an enum introduced in interface version
> > > 1 would trigger warnings about version running backards.
>
> "backwards." :)
>
> Doesn't this affect the xml output and therefore fail the scanner tests?
> If so, should be accompanied w/ a commit that updates the scanner test xml.
yep, sorry. I'll run make check for patchsets from now on :)
new series is on the list, thanks.
Cheers,
Peter
>
> yong
>
>
> >
> > This doesn't matter for the output, it's just warnings, hence why they're
> > skipped here.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > src/scanner.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/src/scanner.c b/src/scanner.c
> > index 5d66fa4..0fab391 100644
> > --- a/src/scanner.c
> > +++ b/src/scanner.c
> > @@ -220,6 +220,7 @@ struct entry {
> > char *uppercase_name;
> > char *value;
> > char *summary;
> > + int since;
> > struct wl_list link;
> > };
> >
> > @@ -797,6 +798,8 @@ start_element(void *data, const char *element_name, const char **atts)
> > fail(&ctx->loc, "no entry name given");
> >
> > entry = create_entry(name, value);
> > + version = version_from_since(ctx, since);
> > + entry->since = version;
> >
> > if (summary)
> > entry->summary = xstrdup(summary);
> > @@ -1288,6 +1291,19 @@ emit_enumerations(struct interface *interface)
> > entry->uppercase_name, entry->value);
> > }
> > printf("};\n");
> > +
> > + wl_list_for_each(entry, &e->entry_list, link) {
> > + if (entry->since == 1)
> > + continue;
> > +
> > + printf("/**\n * @ingroup iface_%s\n */\n", interface->name);
> > + printf("#define %s_%s_%s_SINCE_VERSION %d\n",
> > + interface->uppercase_name,
> > + e->uppercase_name, entry->uppercase_name,
> > + entry->since);
> > +
> > + }
> > +
> > printf("#endif /* %s_%s_ENUM */\n\n",
> > interface->uppercase_name, e->uppercase_name);
> > }
> > --
> > 2.9.3
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
More information about the wayland-devel
mailing list