Avoiding duplication is necessary for typelibs, but there's no reason to explicitly duplicate if we aren't building a typelib.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- tools/widl/typetree.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index b93806be98..4a78350858 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -299,19 +299,17 @@ type_t *type_new_enum(const char *name, struct namespace *namespace, int defined
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields) { - type_t *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL; type_t *t;
/* avoid creating duplicate typelib type entries */ - if (tag_type && do_typelib) return tag_type; + if (name && (t = find_type(name, namespace, tsSTRUCT))) + return t;
t = make_type(TYPE_STRUCT); t->name = name; t->namespace = namespace;
- if (tag_type && tag_type->details.structure) - t->details.structure = tag_type->details.structure; - else if (defined) + if (defined) { t->details.structure = xmalloc(sizeof(*t->details.structure)); t->details.structure->fields = fields;
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47035 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- tools/widl/typetree.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 4a78350858..fc40fbaa7c 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -273,14 +273,17 @@ type_t *type_new_void(void)
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums) { - type_t *tag_type = name ? find_type(name, namespace, tsENUM) : NULL; - type_t *t = make_type(TYPE_ENUM); + type_t *t; + + /* avoid creating duplicate typelib type entries */ + if (name && (t = find_type(name, namespace, tsENUM))) + return t; + + t = make_type(TYPE_ENUM); t->name = name; t->namespace = namespace;
- if (tag_type && tag_type->details.enumeration) - t->details.enumeration = tag_type->details.enumeration; - else if (defined) + if (defined) { t->details.enumeration = xmalloc(sizeof(*t->details.enumeration)); t->details.enumeration->enums = enums; @@ -327,12 +330,16 @@ type_t *type_new_struct(char *name, struct namespace *namespace, int defined, va
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields) { - type_t *tag_type = name ? find_type(name, NULL, tsUNION) : NULL; - type_t *t = make_type(TYPE_UNION); + type_t *t; + + /* avoid creating duplicate typelib type entries */ + if (name && (t = find_type(name, NULL, tsUNION))) + return t; + + t = make_type(TYPE_UNION); t->name = name; - if (tag_type && tag_type->details.structure) - t->details.structure = tag_type->details.structure; - else if (defined) + + if (defined) { t->details.structure = xmalloc(sizeof(*t->details.structure)); t->details.structure->fields = fields;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=51083
Your paranoid android.
=== debian9 (build log) ===
../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:170: recipe for target 'cache.o' failed Makefile:9277: recipe for target 'dlls/sxs' failed Task: The win32 build failed
=== debian9 (build log) ===
../../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:172: recipe for target 'cache.cross.o' failed Makefile:9018: recipe for target 'dlls/sxs/tests' failed ../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:170: recipe for target 'cache.o' failed ../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:203: recipe for target 'name.o' failed Makefile:9018: recipe for target 'dlls/sxs' failed Task: The wow64 build failed
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=51082
Your paranoid android.
=== debian9 (build log) ===
../../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:172: recipe for target 'cache.cross.o' failed Makefile:9277: recipe for target 'dlls/sxs/tests' failed ../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:170: recipe for target 'cache.o' failed Makefile:9277: recipe for target 'dlls/sxs' failed Task: The win32 build failed
=== debian9 (build log) ===
../../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:172: recipe for target 'cache.cross.o' failed Makefile:9018: recipe for target 'dlls/sxs/tests' failed ../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:170: recipe for target 'cache.o' failed ../../include/winsxs.h:93:22: error: redefinition of ‘struct _FUSION_INSTALL_REFERENCE_’ Makefile:203: recipe for target 'name.o' failed Makefile:9018: recipe for target 'dlls/sxs' failed Task: The wow64 build failed