* [RFC] broken build using bison-1.75
@ 2002-11-05 9:54 Theodore A. Roth
2002-11-06 12:23 ` Michael Snyder
2002-11-07 12:05 ` Jim Blandy
0 siblings, 2 replies; 10+ messages in thread
From: Theodore A. Roth @ 2002-11-05 9:54 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 529 bytes --]
Hi,
Looks like debian testing is using bison-1.75 now (was using 1.35
previously) which has some minor problems parsing some of the yacc files.
The attached patch got gdb to compile for me using bison 1.75 and 1.35 on
a debian system. The missing semicolons seem obvious fixes to me, but the
new setup rule I added I'm not sure about since I can't test this myself
and don't have a good understanding of yacc grammar.
For what it's worth, here's my configure options:
--target=avr --enable-build-warnings=-Werror
Ted Roth
[-- Attachment #2: Type: TEXT/PLAIN, Size: 3619 bytes --]
2002-11-05 Theodore A. Roth <troth@openavr.org>
* gdb/c-exp.y: Add missing semi-colons.
* gdb/f-exp.y: Add missing semi-colons.
* gdb/m2-exp.y: Add missing semi-colons.
* gdb/p-exp.y: Add missing semi-colons.
Add setup rule to avoid a type clash.
Index: gdb/c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.16
diff -u -r1.16 c-exp.y
--- gdb/c-exp.y 11 Oct 2002 14:02:37 -0000 1.16
+++ gdb/c-exp.y 5 Nov 2002 17:40:43 -0000
@@ -247,9 +247,11 @@
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
Index: gdb/f-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/f-exp.y,v
retrieving revision 1.8
diff -u -r1.8 f-exp.y
--- gdb/f-exp.y 3 Sep 2002 02:45:56 -0000 1.8
+++ gdb/f-exp.y 5 Nov 2002 17:40:43 -0000
@@ -241,9 +241,11 @@
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@ -283,6 +285,7 @@
arglist : substring
{ arglist_len = 2;}
+ ;
arglist : arglist ',' exp %prec ABOVE_COMMA
{ arglist_len++; }
Index: gdb/m2-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/m2-exp.y,v
retrieving revision 1.6
diff -u -r1.6 m2-exp.y
--- gdb/m2-exp.y 3 Sep 2002 02:45:56 -0000 1.6
+++ gdb/m2-exp.y 5 Nov 2002 17:40:46 -0000
@@ -216,6 +216,7 @@
exp : exp '^' %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '-'
{ number_sign = -1; }
@@ -330,6 +331,7 @@
exp : EXCL '(' exp ',' exp ')'
{ error("Sets are not implemented.");}
+ ;
set : '{' arglist '}'
{ error("Sets are not implemented.");}
Index: gdb/p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.16
diff -u -r1.16 p-exp.y
--- gdb/p-exp.y 11 Oct 2002 14:02:38 -0000 1.16
+++ gdb/p-exp.y 5 Nov 2002 17:40:46 -0000
@@ -162,7 +162,7 @@
static int search_field;
%}
-%type <voidval> exp exp1 type_exp start normal_start variable qualified_name
+%type <voidval> exp exp1 type_exp start setup normal_start variable qualified_name
%type <tval> type typebase
/* %type <bval> block */
@@ -230,10 +230,13 @@
\f
%%
-start : { current_type = NULL;
+start : setup normal_start
+ ;
+
+setup : { current_type = NULL;
search_field = 0;
}
- normal_start;
+ ;
normal_start :
exp1
@@ -257,11 +260,13 @@
{ write_exp_elt_opcode (UNOP_IND);
if (current_type)
current_type = TYPE_TARGET_TYPE (current_type); }
+ ;
exp : '@' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR);
if (current_type)
current_type = TYPE_POINTER_TYPE (current_type); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@ -317,6 +322,7 @@
write_exp_elt_opcode (BINOP_SUBSCRIPT);
if (current_type)
current_type = TYPE_TARGET_TYPE (current_type); }
+ ;
exp : exp '('
/* This is to save the value of arglist_len
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RFC] broken build using bison-1.75
2002-11-05 9:54 [RFC] broken build using bison-1.75 Theodore A. Roth
@ 2002-11-06 12:23 ` Michael Snyder
2002-11-06 12:54 ` Theodore A. Roth
2002-11-07 12:05 ` Jim Blandy
1 sibling, 1 reply; 10+ messages in thread
From: Michael Snyder @ 2002-11-06 12:23 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
"Theodore A. Roth" wrote:
>
> Hi,
>
> Looks like debian testing is using bison-1.75 now (was using 1.35
> previously) which has some minor problems parsing some of the yacc files.
>
> The attached patch got gdb to compile for me using bison 1.75 and 1.35 on
> a debian system. The missing semicolons seem obvious fixes to me, but the
> new setup rule I added I'm not sure about since I can't test this myself
> and don't have a good understanding of yacc grammar.
>
> For what it's worth, here's my configure options:
>
> --target=avr --enable-build-warnings=-Werror
>
> Ted Roth
Yeah, bison has fallen into dis-use in favor of byacc.
I'll give you approval to check in all the missing semicolons.
As for the new setup rule, have you tested it using byacc?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] broken build using bison-1.75
2002-11-06 12:23 ` Michael Snyder
@ 2002-11-06 12:54 ` Theodore A. Roth
2002-11-06 13:25 ` Michael Snyder
2002-11-07 9:47 ` Jim Blandy
0 siblings, 2 replies; 10+ messages in thread
From: Theodore A. Roth @ 2002-11-06 12:54 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
On Wed, 6 Nov 2002, Michael Snyder wrote:
:) "Theodore A. Roth" wrote:
:) > The attached patch got gdb to compile for me using bison 1.75 and 1.35 on
:) > a debian system. The missing semicolons seem obvious fixes to me, but the
:) > new setup rule I added I'm not sure about since I can't test this myself
:) > and don't have a good understanding of yacc grammar.
<snip>
:) Yeah, bison has fallen into dis-use in favor of byacc.
:) I'll give you approval to check in all the missing semicolons.
:) As for the new setup rule, have you tested it using byacc?
Just compiled with byacc 1.9 and it didn't puke on the setup rule I added.
I not sure if my setup rule is the right thing to do and was hoping
someone with more experience could comment on it correctness (or lack
thereof). I based the change on the information at the end of this page:
http://www.gnu.org/manual/bison/html_node/Mid-Rule-Actions.html
Ted Roth
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] broken build using bison-1.75
2002-11-06 12:54 ` Theodore A. Roth
@ 2002-11-06 13:25 ` Michael Snyder
2002-11-07 9:47 ` Jim Blandy
1 sibling, 0 replies; 10+ messages in thread
From: Michael Snyder @ 2002-11-06 13:25 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
"Theodore A. Roth" wrote:
>
> On Wed, 6 Nov 2002, Michael Snyder wrote:
>
> :) "Theodore A. Roth" wrote:
> :) > The attached patch got gdb to compile for me using bison 1.75 and 1.35 on
> :) > a debian system. The missing semicolons seem obvious fixes to me, but the
> :) > new setup rule I added I'm not sure about since I can't test this myself
> :) > and don't have a good understanding of yacc grammar.
>
> <snip>
>
> :) Yeah, bison has fallen into dis-use in favor of byacc.
> :) I'll give you approval to check in all the missing semicolons.
> :) As for the new setup rule, have you tested it using byacc?
>
> Just compiled with byacc 1.9 and it didn't puke on the setup rule I added.
>
> I not sure if my setup rule is the right thing to do and was hoping
> someone with more experience could comment on it correctness (or lack
> thereof). I based the change on the information at the end of this page:
>
> http://www.gnu.org/manual/bison/html_node/Mid-Rule-Actions.html
What was the error that bison was giving you?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] broken build using bison-1.75
2002-11-06 12:54 ` Theodore A. Roth
2002-11-06 13:25 ` Michael Snyder
@ 2002-11-07 9:47 ` Jim Blandy
1 sibling, 0 replies; 10+ messages in thread
From: Jim Blandy @ 2002-11-07 9:47 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: Michael Snyder, gdb-patches
"Theodore A. Roth" <troth@openavr.org> writes:
> On Wed, 6 Nov 2002, Michael Snyder wrote:
>
> :) "Theodore A. Roth" wrote:
> :) > The attached patch got gdb to compile for me using bison 1.75 and 1.35 on
> :) > a debian system. The missing semicolons seem obvious fixes to me, but the
> :) > new setup rule I added I'm not sure about since I can't test this myself
> :) > and don't have a good understanding of yacc grammar.
>
> <snip>
>
> :) Yeah, bison has fallen into dis-use in favor of byacc.
> :) I'll give you approval to check in all the missing semicolons.
> :) As for the new setup rule, have you tested it using byacc?
>
> Just compiled with byacc 1.9 and it didn't puke on the setup rule I added.
>
> I not sure if my setup rule is the right thing to do and was hoping
> someone with more experience could comment on it correctness (or lack
> thereof). I based the change on the information at the end of this page:
>
> http://www.gnu.org/manual/bison/html_node/Mid-Rule-Actions.html
If that special setup rule is necessary in p-exp.y, that's a bug in
Bison, I'm pretty sure.
The trick of introducing a new non-terminal symbol with no tokens and
an action should only be necessary when Bison doesn't have enough
information from the grammar to tell whether to execute the action.
But the 'start' symbol isn't used anywhere else in the grammar, and it
doesn't have any alternatives --- if you're in the start state, you've
got to run that action.
(And as a sanity check --- the paragraph at the end of the section of
the Bison manual you posted a link to says that you're doing manually
what Bison is supposed to do automatically to handle internal
actions.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] broken build using bison-1.75
2002-11-05 9:54 [RFC] broken build using bison-1.75 Theodore A. Roth
2002-11-06 12:23 ` Michael Snyder
@ 2002-11-07 12:05 ` Jim Blandy
2002-11-07 12:14 ` Jim Blandy
1 sibling, 1 reply; 10+ messages in thread
From: Jim Blandy @ 2002-11-07 12:05 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
I think I've figured out what the real problem is, here.
If you write a rule without a final action, like the start rule from
p-exp.y:
start : { current_type = NULL;
search_field = 0;
}
normal_start;
then Bison inserts a default final action, { $$ = $1; }. However, in
this example, that's a bad idea, since $1 refers to the mid-rule
action `{ current_type = ... }', and that has to type. That's why the
error message says:
/home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:248.5-251.3: type clash (`voidval' `') on default action
I think that's complaining that there's a clash between the type of
`start', which is `voidval', and the type of the mid-rule action,
which is being printed as `'.
Your fix changes that into:
start : setup normal_start
;
setup : { current_type = NULL;
search_field = 0;
}
;
And since you also add the declaration:
%type <voidval> ... setup ...
The `start' rule's $1 is now `setup', which is declared to have type
`voidval'.
Ironically, if you don't declare a type for a rule, yacc just assumes
it doesn't return a value --- which is what's actually going on here.
So I think it would be simplest just to delete all uses of `voidval'
altogether. (Its presence predates Red Hat's internal CVS repository,
inherited from Cygnus, which has history back to 1991. And it's not
mentioned in any of the ChangeLogs.)
Here's a patch that does that. The result compiles cleanly using
Bison 1.28, byacc 1.9, and Bison 1.75. The same could be done for the
other grammars, too.
2002-11-07 Jim Blandy <jimb@redhat.com>
Don't give a type for rules that return no value; this is what
yacc expects, so the error-checking works better.
* p-exp.y (%union): Remove `voidval' member.
(exp, exp1, type_exp, start, normal_start, variable,
qualified_name, VARIABLE): Don't declare these to have type
'voidval'.
(start): No need for dummy action here.
Index: gdb/p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.17
diff -c -r1.17 p-exp.y
*** gdb/p-exp.y 6 Nov 2002 22:48:25 -0000 1.17
--- gdb/p-exp.y 7 Nov 2002 19:57:18 -0000
***************
*** 141,147 ****
struct stoken sval;
struct ttype tsym;
struct symtoken ssym;
- int voidval;
struct block *bval;
enum exp_opcode opcode;
struct internalvar *ivar;
--- 141,146 ----
***************
*** 162,168 ****
static int search_field;
%}
- %type <voidval> exp exp1 type_exp start normal_start variable qualified_name
%type <tval> type typebase
/* %type <bval> block */
--- 161,166 ----
***************
*** 200,206 ****
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
! %token <voidval> VARIABLE
/* Object pascal */
--- 198,204 ----
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
! %token VARIABLE
/* Object pascal */
***************
*** 233,239 ****
start : { current_type = NULL;
search_field = 0;
}
! normal_start {}
;
normal_start :
--- 231,237 ----
start : { current_type = NULL;
search_field = 0;
}
! normal_start
;
normal_start :
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RFC] broken build using bison-1.75
2002-11-07 12:05 ` Jim Blandy
@ 2002-11-07 12:14 ` Jim Blandy
0 siblings, 0 replies; 10+ messages in thread
From: Jim Blandy @ 2002-11-07 12:14 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
Possibly confusing typo in my message:
Jim Blandy <jimb@redhat.com> writes:
> If you write a rule without a final action, like the start rule from
> p-exp.y:
>
> start : { current_type = NULL;
> search_field = 0;
> }
> normal_start;
>
> then Bison inserts a default final action, { $$ = $1; }. However, in
> this example, that's a bad idea, since $1 refers to the mid-rule
> action `{ current_type = ... }', and that has to type. That's why the
I meant to say: has no type
> error message says:
>
> /home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:248.5-251.3: type clash (`voidval' `') on default action
>
> I think that's complaining that there's a clash between the type of
> `start', which is `voidval', and the type of the mid-rule action,
> which is being printed as `'.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC] broken build using bison-1.75
@ 2002-11-06 13:38 Johannes Stezenbach
2002-11-06 13:57 ` Theodore A. Roth
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Stezenbach @ 2002-11-06 13:38 UTC (permalink / raw)
To: Michael Snyder, Theodore A. Roth; +Cc: gdb-patches
Hi,
I just fumbled with this two days ago, but did not post to the
list immediately because I'm not subscribed. The fix is similar
to what the binutils people were doing.
/bin/sh ../../gdb+dejagnu-5.3-branch-20021031/gdb/../ylwrap "bison -y" ../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y y.tab.c c-exp.tmp --
/home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:248.5-251.3: type clash (`voidval' `') on default action
/home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:251.5: parse error, unexpected ":", expecting ";" or "|"
make[1]: *** [c-exp.tab.c] Error 1
--- gdb+dejagnu-5.3-branch-20021031/gdb/p-exp.y.orig 2002-11-04 21:15:06.000000000 +0100
+++ gdb+dejagnu-5.3-branch-20021031/gdb/p-exp.y 2002-11-04 21:18:35.000000000 +0100
@@ -233,7 +233,8 @@
start : { current_type = NULL;
search_field = 0;
}
- normal_start;
+ normal_start {}
+ ;
normal_start :
exp1
Regards,
Johannes
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RFC] broken build using bison-1.75
2002-11-06 13:38 Johannes Stezenbach
@ 2002-11-06 13:57 ` Theodore A. Roth
2002-11-06 14:05 ` Johannes Stezenbach
0 siblings, 1 reply; 10+ messages in thread
From: Theodore A. Roth @ 2002-11-06 13:57 UTC (permalink / raw)
To: Johannes Stezenbach; +Cc: Michael Snyder, Theodore A. Roth, gdb-patches
On Wed, 6 Nov 2002, Johannes Stezenbach wrote:
:) Hi,
:)
:) I just fumbled with this two days ago, but did not post to the
:) list immediately because I'm not subscribed. The fix is similar
:) to what the binutils people were doing.
:)
:) /bin/sh ../../gdb+dejagnu-5.3-branch-20021031/gdb/../ylwrap "bison -y" ../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y y.tab.c c-exp.tmp --
:) /home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:248.5-251.3: type clash (`voidval' `') on default action
:) /home/js/MIPS/toolchain/mips-linux-gdb/gdb/../../gdb+dejagnu-5.3-branch-20021031/gdb/c-exp.y:251.5: parse error, unexpected ":", expecting ";" or "|"
:) make[1]: *** [c-exp.tab.c] Error 1
Yup, that's exactly what I'm seeing.
:)
:) --- gdb+dejagnu-5.3-branch-20021031/gdb/p-exp.y.orig 2002-11-04 21:15:06.000000000 +0100
:) +++ gdb+dejagnu-5.3-branch-20021031/gdb/p-exp.y 2002-11-04 21:18:35.000000000 +0100
:) @@ -233,7 +233,8 @@
:) start : { current_type = NULL;
:) search_field = 0;
:) }
:) - normal_start;
:) + normal_start {}
:) + ;
:)
:) normal_start :
:) exp1
:)
That looks much nicer and simpler than my fix. Do you have a reference to
what the binutils people are doing so I can try to grok the fix?
Ted Roth
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-11-07 20:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05 9:54 [RFC] broken build using bison-1.75 Theodore A. Roth
2002-11-06 12:23 ` Michael Snyder
2002-11-06 12:54 ` Theodore A. Roth
2002-11-06 13:25 ` Michael Snyder
2002-11-07 9:47 ` Jim Blandy
2002-11-07 12:05 ` Jim Blandy
2002-11-07 12:14 ` Jim Blandy
2002-11-06 13:38 Johannes Stezenbach
2002-11-06 13:57 ` Theodore A. Roth
2002-11-06 14:05 ` Johannes Stezenbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox