[PATCH 03/11] widl: Allow attributes before and after typedef-keyword.

Kai Tietz ktietz70 at googlemail.com
Thu Aug 8 11:47:02 CDT 2013


Due line wrap, I sent patch as attachment.

Kai
-------------- next part --------------
From 1a64feb99a1a5e1633bc9081dcc51f2b893a7f81 Mon Sep 17 00:00:00 2001
From: Kai Tietz <ktietz70 at googlemail.com>
Date: Thu, 8 Aug 2013 15:59:27 +0200
Subject: [PATCH 03/11] widl: Allow attributes before and after
 typedef-keyword.

widl: Allow attribute specification before and after typedef-keyword.
---
 tools/widl/parser.y |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 0748f9c..77ac679 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -122,6 +122,7 @@ static statement_t *make_statement_import(const char *str);
 static statement_t *make_statement_typedef(var_list_t *names);
 static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
 static statement_list_t *append_statements(statement_list_t *, statement_list_t *);
+static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
 
 %}
 %union {
@@ -1093,9 +1094,10 @@ type:	  tVOID					{ $$ = type_new_void(); }
 	| tSAFEARRAY '(' type ')'		{ $$ = make_safearray($3); }
 	;
 
-typedef: tTYPEDEF m_attributes decl_spec declarator_list
-						{ reg_typedefs($3, $4, check_typedef_attrs($2));
-						  $$ = make_statement_typedef($4);
+typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
+						{ $1 = append_attribs($1, $3);
+						  reg_typedefs($4, $5, check_typedef_attrs($1));
+						  $$ = make_statement_typedef($5);
 						}
 	;
 
@@ -2802,6 +2804,14 @@ static statement_list_t *append_statements(statement_list_t *l1, statement_list_
   return l1;
 }
 
+static attr_list_t *append_attribs(attr_list_t *l1, attr_list_t *l2)
+{
+  if (!l2) return l1;
+  if (!l1 || l1 == l2) return l2;
+  list_move_tail (l1, l2);
+  return l1;
+}
+
 static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt)
 {
     if (!stmt) return list;
-- 
1.7.9


More information about the wine-patches mailing list