[PATCH] guard enums in generated wayland-*-protocol.h

Kristian Høgsberg krh at bitplanet.net
Sun Jan 23 10:36:37 PST 2011


On Sun, Jan 23, 2011 at 6:21 AM, Tim Wiederhake <twied at gmx.net> wrote:
> ---
>  wayland/scanner.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)

Yup, that's what I had in mind, thanks.  I edited the #define prefix
to keep it in the WL_* namespace.

thanks,
Kristian

> diff --git a/wayland/scanner.c b/wayland/scanner.c
> index 91054b7..b24ee39 100644
> --- a/wayland/scanner.c
> +++ b/wayland/scanner.c
> @@ -470,13 +470,19 @@ emit_enumerations(struct interface *interface)
>        struct entry *entry;
>
>        wl_list_for_each(e, &interface->enumeration_list, link) {
> +                printf("#ifndef ENUM_%s_%s\n", interface->uppercase_name,
> +                       e->uppercase_name);
> +                printf("#define ENUM_%s_%s\n", interface->uppercase_name,
> +                       e->uppercase_name);
>                printf("enum wl_%s_%s {\n", interface->name, e->name);
>                wl_list_for_each(entry, &e->entry_list, link)
>                        printf("\tWL_%s_%s_%s = %s,\n",
>                               interface->uppercase_name,
>                               e->uppercase_name,
>                               entry->uppercase_name, entry->value);
> -               printf("};\n\n");
> +               printf("};\n");
> +               printf("#endif /* ENUM_%s_%s */\n\n", interface->uppercase_name,
> +                       e->uppercase_name);
>        }
>  }
>
> --
> 1.7.2.3
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>


More information about the wayland-devel mailing list