diff options
| author | Marty E. Plummer <hanetzer@startmail.com> | 2019-05-11 09:53:01 -0500 |
|---|---|---|
| committer | Marty E. Plummer <hanetzer@startmail.com> | 2019-09-11 13:27:03 -0500 |
| commit | 9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4 (patch) | |
| tree | 67a90352370263a6e5ed131dee186fac0f6972d1 /src | |
| parent | tests: Test that send overflow doesn't abort (diff) | |
| download | wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar.gz wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar.bz2 wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar.lz wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar.xz wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.tar.zst wayland-9f004d8b0fa37787fe96662cf5ff414e8d6ef5e4.zip | |
scanner: prepend protocol name to types symbol
When doing unity builds via meson (example project:
https://github.com/swaywm/sway) multiple source files are glued together
via #include directives. Having every wayland-scanner generated source
file have an identifier named '*types[]' will lead to errors in these
unity builds if two or more of these are joined.
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/scanner.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/scanner.c b/src/scanner.c index 8cffea5..7ed1ba1 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1722,7 +1722,7 @@ emit_types(struct protocol *protocol, struct wl_list *message_list) } static void -emit_messages(struct wl_list *message_list, +emit_messages(const char *name, struct wl_list *message_list, struct interface *interface, const char *suffix) { struct message *m; @@ -1775,7 +1775,7 @@ emit_messages(struct wl_list *message_list, break; } } - printf("\", types + %d },\n", m->type_index); + printf("\", %s_types + %d },\n", name, m->type_index); } printf("};\n\n"); @@ -1832,7 +1832,7 @@ emit_code(struct protocol *protocol, enum visibility vis) wl_array_release(&types); printf("\n"); - printf("static const struct wl_interface *types[] = {\n"); + printf("static const struct wl_interface *%s_types[] = {\n", protocol->name); emit_null_run(protocol); wl_list_for_each(i, &protocol->interface_list, link) { emit_types(protocol, &i->request_list); @@ -1842,8 +1842,8 @@ emit_code(struct protocol *protocol, enum visibility vis) wl_list_for_each_safe(i, next, &protocol->interface_list, link) { - emit_messages(&i->request_list, i, "requests"); - emit_messages(&i->event_list, i, "events"); + emit_messages(protocol->name, &i->request_list, i, "requests"); + emit_messages(protocol->name, &i->event_list, i, "events"); printf("%s const struct wl_interface " "%s_interface = {\n" |
