WIDL: Add missing ignore attribute. Check for inapplicable attributes in typedef.

Saveliy Tretiakov saveliyt at mail.ru
Thu Mar 16 00:58:42 CST 2006


Parse typedef attributes in a way Mike McCormack suggested.

ChangeLog:
Saveliy Tretiakov <saveliyt at mail.ru>
Add missing ignore attribute.
Check for inapplicable attributes in typedef.
Register type alias (without attributes) in typelib, if ATTR_PUBLIC is set.





-------------- next part --------------
Index: tools/widl/parser.l
===================================================================
RCS file: /home/wine/wine/tools/widl/parser.l,v
retrieving revision 1.35
diff -u -p -r1.35 parser.l
--- tools/widl/parser.l	9 Feb 2006 11:51:32 -0000	1.35
+++ tools/widl/parser.l	15 Mar 2006 13:48:51 -0000
@@ -228,6 +228,7 @@ static struct keyword {
 	{"hyper",			tHYPER},
 	{"id",				tID},
 	{"idempotent",			tIDEMPOTENT},
+	{"ignore", tIGNORE },
 /* ... */
 	{"iid_is",			tIIDIS},
 	{"immediatebind",		tIMMEDIATEBIND},
Index: tools/widl/parser.y
===================================================================
RCS file: /home/wine/wine/tools/widl/parser.y,v
retrieving revision 1.63
diff -u -p -r1.63 parser.y
--- tools/widl/parser.y	9 Feb 2006 11:51:32 -0000	1.63
+++ tools/widl/parser.y	16 Mar 2006 06:24:28 -0000
@@ -198,8 +198,10 @@ static type_t std_uhyper = { "MIDL_uhype
 %token tVERSION
 %token tVOID
 %token tWCHAR tWIREMARSHAL
+%token tIGNORE
 
 %type <attr> m_attributes attributes attrib_list attribute
+%type <attr> typedef_attributes typedef_attrib_list typedef_attribute
 %type <expr> m_exprs /* exprs expr_list */ m_expr expr expr_list_const expr_const
 %type <expr> array array_list
 %type <type> inherit interface interfacehdr interfacedef interfacedec
@@ -374,6 +376,7 @@ attribute:
 	| tHIDDEN				{ $$ = make_attr(ATTR_HIDDEN); }
 	| tID '(' expr_const ')'		{ $$ = make_attrp(ATTR_ID, $3); }
 	| tIDEMPOTENT				{ $$ = make_attr(ATTR_IDEMPOTENT); }
+	| tIGNORE				{ $$ = make_attr(ATTR_IGNORE); }
 	| tIIDIS '(' ident ')'			{ $$ = make_attrp(ATTR_IIDIS, $3); }
 	| tIMMEDIATEBIND			{ $$ = make_attr(ATTR_IMMEDIATEBIND); }
 	| tIMPLICITHANDLE '(' tHANDLET aIDENTIFIER ')'	{ $$ = make_attrp(ATTR_IMPLICIT_HANDLE, $4); }
@@ -768,14 +771,38 @@ type:	  tVOID					{ $$ = make_tref(NULL,
 	| tUNION aIDENTIFIER			{ $$ = make_tref(NULL, find_type2($2, tsUNION)); }
 	;
 
-typedef: tTYPEDEF m_attributes type pident_list	{ typeref_t *tref = uniq_tref($3);
+
+typedef_attributes: { $$ = NULL; }
+	| '[' typedef_attrib_list ']'			{ $$ = $2; }
+	;
+
+typedef_attrib_list: typedef_attribute
+	| typedef_attrib_list ',' typedef_attribute		{ LINK($3, $1); $$ = $3; }
+	| typedef_attrib_list ']' '[' typedef_attribute		{ LINK($4, $1); $$ = $4; }
+	;
+
+typedef_attribute:
+	tCONTEXTHANDLE			{ $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); }
+	| tCONTEXTHANDLENOSERIALIZE		{ $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ }
+	| tCONTEXTHANDLESERIALIZE		{ $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ }
+	| tHANDLE				{ $$ = make_attr(ATTR_HANDLE); }
+	| tIGNORE				{ $$ = make_attr(ATTR_IGNORE); }
+	| tSTRING				{ $$ = make_attr(ATTR_STRING); }
+	| tSWITCHTYPE '(' type ')'		{ $$ = make_attrp(ATTR_SWITCHTYPE, type_ref($3)); }
+	| tTRANSMITAS '(' type ')'		{ $$ = make_attrp(ATTR_TRANSMITAS, type_ref($3)); }
+	| tPUBLIC				{ $$ = make_attr(ATTR_PUBLIC); }
+	| pointer_type				{ $$ = make_attrv(ATTR_POINTERTYPE, $1); }
+	;
+
+typedef: tTYPEDEF typedef_attributes type pident_list	{ 
+						  typeref_t *tref = uniq_tref($3);
 						  $4->tname = tref->name;
 						  tref->name = NULL;
 						  $$ = type_ref(tref);
 						  $$->attrs = $2;
 						  if (!parse_only && do_header)
 						    write_typedef($$, $4);
-						  if (in_typelib && $$->attrs)
+						  if (in_typelib && ($$->attrs || is_attr($2, ATTR_PUBLIC)))
 						    add_typedef($$, $4);
 						  reg_types($$, $4, 0);
 						}
Index: tools/widl/widltypes.h
===================================================================
RCS file: /home/wine/wine/tools/widl/widltypes.h,v
retrieving revision 1.36
diff -u -p -r1.36 widltypes.h
--- tools/widl/widltypes.h	9 Feb 2006 11:51:32 -0000	1.36
+++ tools/widl/widltypes.h	15 Mar 2006 14:31:01 -0000
@@ -88,6 +88,7 @@ enum attr_type
     ATTR_ID,
     ATTR_IDEMPOTENT,
     ATTR_IIDIS,
+    ATTR_IGNORE,
     ATTR_IMMEDIATEBIND,
     ATTR_IMPLICIT_HANDLE,
     ATTR_IN,


More information about the wine-patches mailing list