From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13095 invoked by alias); 7 Nov 2002 20:05:52 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13059 invoked from network); 7 Nov 2002 20:05:50 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by sources.redhat.com with SMTP; 7 Nov 2002 20:05:50 -0000 Received: (from jimb@localhost) by zenia.red-bean.com (8.11.6/8.11.6) id gA7JonQ30680; Thu, 7 Nov 2002 14:50:49 -0500 To: "Theodore A. Roth" Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC] broken build using bison-1.75 References: From: Jim Blandy Date: Thu, 07 Nov 2002 12:05:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.90 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-11/txt/msg00192.txt.bz2 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 ... 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 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 exp exp1 type_exp start normal_start variable qualified_name %type type typebase /* %type block */ --- 161,166 ---- *************** *** 200,206 **** /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ ! %token 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 :