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

Tim Wiederhake twied at gmx.net
Sun Jan 23 03:21:15 PST 2011


---
 wayland/scanner.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

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



More information about the wayland-devel mailing list