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.

This doesn't matter for the output, it's just warnings, hence why they're
skipped here.

Signed-off-by: Peter Hutterer <[email protected]>
---
 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to