From 8d43c54ed2a877ce4dcdb867a26988c6e0c097bf Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 10 Aug 2015 13:19:29 +0200 Subject: [PATCH] widl: Allow [version] attribute to be used on structs in winrt mode. --- tools/widl/parser.y | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 725cd3b6329..ba0be1c4107 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -2064,7 +2064,7 @@ struct allowed_attr unsigned int on_arg : 1; unsigned int on_type : 1; unsigned int on_enum : 1; - unsigned int on_struct : 1; + unsigned int on_struct : 2; unsigned int on_union : 1; unsigned int on_field : 1; unsigned int on_library : 1; @@ -2175,7 +2175,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, "uuid" }, /* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, "v1_enum" }, /* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" }, - /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, "version" }, + /* ATTR_VERSION */ { 1, 0, 1, 0, 0, 1, 1, 2, 0, 0, 1, 0, 0, 1, "version" }, /* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "vi_progid" }, /* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" }, }; @@ -2265,11 +2265,12 @@ static attr_list_t *check_enum_attrs(attr_list_t *attrs) static attr_list_t *check_struct_attrs(attr_list_t *attrs) { + int mask = winrt_mode ? 3 : 1; const attr_t *attr; if (!attrs) return attrs; LIST_FOR_EACH_ENTRY(attr, attrs, const attr_t, entry) { - if (!allowed_attr[attr->type].on_struct) + if (!(allowed_attr[attr->type].on_struct & mask)) error_loc("inapplicable attribute %s for struct\n", allowed_attr[attr->type].display_name); }