Fix building tools/widl (for bison 1.75, among others) (fwd)

Gerald Pfeifer gerald at pfeifer.com
Fri May 2 08:51:49 CDT 2008


[ Acked by Rob on wine-devel ]

After the following change about a week ago

  Rob Shearman <rob at codeweavers.com>
  widl: Make the rules for parsing fields in structures, encapsulated unions 
  and non-encapsulated unions more strict.

  Move the rules in fields that handle empty union cases into separate
  union rules so that they can't erroneously be accepted for structures or
  other types of unions.

I started seeing the following build failure on one older installation:

  bison  -p parser_ -o parser.tab.c -d parser.y
  parser.y:749.2-751.15: type clash (`var' `attr_list') on default action
  parser.y:751.16: parse error, unexpected ":", expecting ";" or "|"
  parser.y:752.35-59: $2 of `ne_union_field' has no declared type
  parser.y:757.2-759.7: type clash (`var' `') on default action
  parser.y:759.8: parse error, unexpected ":", expecting ";" or "|"
  parser.y:759.45-760.50: $1 of `union_field' has no declared type
  parser.y:759.45-761.23: $2 of `union_field' has no declared type
  gmake: *** [parser.tab.h] Error 1

It turns out that current versions of bison do not enforce the documented 
grammer as strictly as older ones such as bison 1.75.  Fixed thusly.

Gerald

ChangeLog:
Fix syntax to also work with older versions of bison.

Index: tools/widl/parser.y
===================================================================
RCS file: /home/wine/wine/tools/widl/parser.y,v
retrieving revision 1.199
diff -u -3 -p -r1.199 parser.y
--- tools/widl/parser.y	1 May 2008 18:38:07 -0000	1.199
+++ tools/widl/parser.y	2 May 2008 12:07:24 -0000
@@ -747,6 +747,7 @@ field:	  m_attributes decl_spec declarat
 ne_union_field:
 	  s_field ';'				{ $$ = $1; }
 	| attributes ';'			{ $$ = make_var(NULL); $$->attrs = $1; }
+        ;
 
 ne_union_fields:				{ $$ = NULL; }
 	| ne_union_fields ne_union_field	{ $$ = append_var( $1, $2 ); }
@@ -755,6 +756,7 @@ ne_union_fields:				{ $$ = NULL; }
 union_field:
 	  s_field ';'				{ $$ = $1; }
 	| ';'					{ $$ = NULL; }
+        ;
 
 s_field:  m_attributes decl_spec declarator	{ $$ = $3->var;
 						  $$->attrs = check_field_attrs($$->name, $1);



More information about the wine-patches mailing list