From 5bf224e84bdff6f575cbfc4b6f04391af75b7f2b Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 11 Aug 2011 18:34:26 +0000 Subject: [PATCH] [WIDL] - Reapply the switchtype patch from widl-ros.diff. This patch should be sent upstream to wine. See issue #6406 for more details. svn path=/trunk/; revision=53187 --- reactos/tools/widl/parser.tab.c | 6 ++++++ reactos/tools/widl/parser.y | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/reactos/tools/widl/parser.tab.c b/reactos/tools/widl/parser.tab.c index d86106855bf..b7faf2874cd 100644 --- a/reactos/tools/widl/parser.tab.c +++ b/reactos/tools/widl/parser.tab.c @@ -6398,6 +6398,12 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC)) attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); + /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */ + if (type_get_type_detect_alias(type) == TYPE_UNION && + is_attr(attrs, ATTR_SWITCHTYPE) && + !is_attr(type->attrs, ATTR_SWITCHTYPE)) + type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE))); + LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry ) { diff --git a/reactos/tools/widl/parser.y b/reactos/tools/widl/parser.y index 5286977529c..ee708ea4394 100644 --- a/reactos/tools/widl/parser.y +++ b/reactos/tools/widl/parser.y @@ -1850,6 +1850,12 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC)) attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); + /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */ + if (type_get_type_detect_alias(type) == TYPE_UNION && + is_attr(attrs, ATTR_SWITCHTYPE) && + !is_attr(type->attrs, ATTR_SWITCHTYPE)) + type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE))); + LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry ) {