Zebediah Figura : widl: Generate a name for the encapsulated union type.

Alexandre Julliard julliard at winehq.org
Wed Aug 21 14:39:33 CDT 2019


Module: wine
Branch: master
Commit: 732f67ed38a45911d726df8da5a68710d175ba1d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=732f67ed38a45911d726df8da5a68710d175ba1d

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Aug 21 11:18:06 2019 -0500

widl: Generate a name for the encapsulated union type.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 072e138..8496109 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 524d005..e9afc6f 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 f025f25..e288c57 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);




More information about the wine-cvs mailing list