After the following change about a week ago
Rob Shearman rob@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);
Gerald Pfeifer wrote:
After the following change about a week ago
Rob Shearman rob@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.
Oops, thanks for spotting it. Actually, I was developing on version 1.28 and didn't get those errors so it doesn't appear to be a deliberate change by the bison developers.
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);
Looks good. Please send to wine-patches.
On Fri, 2 May 2008, Robert Shearman wrote:
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.
Oops, thanks for spotting it. Actually, I was developing on version 1.28 and didn't get those errors so it doesn't appear to be a deliberate change by the bison developers.
This is interesting. Possibly the bison developers got feedback that the stricter checks in 1.75 caused to many troubles (even though they were correct per se)?
Looks good. Please send to wine-patches.
Oops. Originally I wasn't sure how to address the problem, so I started this e-mail to wine-devel and then failed to adjust the address once I had an actual patch. Thanks for spotting this -- the patch now made it into this week's release. :-)
Gerald