[PATCH 1/5] widl: Generate a name for the encapsulated union type.

Zebediah Figura z.figura12 at gmail.com
Wed Aug 21 11:18:06 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 tools/widl/parser.y   | 3 +--
 tools/widl/typetree.c | 2 +-
 tools/widl/typetree.h | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 072e138ecf..8496109299 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -82,7 +82,6 @@ static var_t *reg_const(var_t *var);
 static void push_namespace(const char *name);
 static void pop_namespace(const char *name);
 
-static char *gen_name(void);
 static void check_arg_attrs(const var_t *arg);
 static void check_statements(const statement_list_t *stmts, int is_inside_library);
 static void check_all_user_types(const statement_list_t *stmts);
@@ -2033,7 +2032,7 @@ var_t *find_const(const char *name, int f)
   return cur->var;
 }
 
-static char *gen_name(void)
+char *gen_name(void)
 {
   static const char format[] = "__WIDL_%s_generated_name_%08lX";
   static unsigned long n = 0;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 524d00571f..e9afc6fdd2 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -366,7 +366,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
     {
         if (!union_field)
             union_field = make_var(xstrdup("tagged_union"));
-        union_field->declspec.type = type_new_nonencapsulated_union(NULL, TRUE, cases);
+        union_field->declspec.type = type_new_nonencapsulated_union(gen_name(), TRUE, cases);
 
         t->details.structure = xmalloc(sizeof(*t->details.structure));
         t->details.structure->fields = append_var(NULL, switch_field);
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index f025f25e59..e288c57400 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -51,6 +51,7 @@ void type_module_define(type_t *module, statement_list_t *stmts);
 type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
 int type_is_equal(const type_t *type1, const type_t *type2);
 const char *type_get_name(const type_t *type, enum name_type name_type);
+char *gen_name(void);
 
 /* FIXME: shouldn't need to export this */
 type_t *duptype(type_t *t, int dupname);
-- 
2.22.0




More information about the wine-devel mailing list