From: Jim Blandy <jimb@redhat.com>
To: "Theodore A. Roth" <troth@openavr.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] broken build using bison-1.75
Date: Thu, 07 Nov 2002 12:05:00 -0000 [thread overview]
Message-ID: <vt2d6phduqv.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211050946290.5490-200000@knuth.amplepower.com>
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 :
next prev parent reply other threads:[~2002-11-07 20:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-05 9:54 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt2d6phduqv.fsf@zenia.red-bean.com \
--to=jimb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=troth@openavr.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox