[PATCH] widl: Allow optional interface parameter on the [activatable] attribute.

Bernhard Kölbl besentv at gmail.com
Thu Jan 20 11:09:58 CST 2022


As per MIDL 3.0. Needed for some WinRT runtime classes.

Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
 tools/widl/parser.y | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index fa863921c92..04365d62280 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -278,6 +278,7 @@ static typelib_t *current_typelib;
 %type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
 %type <expr> contract_req
 %type <expr> static_attr
+%type <expr> activatable_attr
 %type <type> delegatedef
 %type <stgclass> storage_cls_spec
 %type <type_qualifier> type_qualifier m_type_qual_list
@@ -580,8 +581,16 @@ static_attr: decl_spec ',' contract_req		{ if ($1->type->type_type != TYPE_INTER
 						  $$ = make_exprt(EXPR_MEMBER, declare_var(NULL, $1, make_declarator(NULL), 0), $3);
 						}
 
+/* The interface part of the activatable attribute is only checked
+for the type, but won't be further used by the following nonterminal. */
+activatable_attr:
+    contract_req  { $$ = $1; }
+  | decl_spec ',' contract_req  { if ($1->type->type_type != TYPE_INTERFACE)
+                                    error_loc("type %s is not an interface\n", $1->type->name);
+                                  $$ = $3; }
+
 attribute:					{ $$ = NULL; }
-	| tACTIVATABLE '(' contract_req ')'	{ $$ = make_attrp(ATTR_ACTIVATABLE, $3); }
+	| tACTIVATABLE '(' activatable_attr ')'	{ $$ = make_attrp(ATTR_ACTIVATABLE, $3); }
 	| tAGGREGATABLE				{ $$ = make_attr(ATTR_AGGREGATABLE); }
 	| tANNOTATION '(' aSTRING ')'		{ $$ = make_attrp(ATTR_ANNOTATION, $3); }
 	| tAPPOBJECT				{ $$ = make_attr(ATTR_APPOBJECT); }
-- 
2.34.1




More information about the wine-devel mailing list