mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
Fix a longstanding bug uncovered by bro-0.9a9/src/parse.y, which I
got from <http://bro-ids.org/download.html>. The bug is that when two actions appeared in succession, the second one was scanned before the first one was added to the grammar rule as a midrule action. Bison then output the incorrect warning "parse.y:905.17-906.36: warning: unused value: $3". * src/parse-gram.y (BRACED_CODE, action): These are no longer associated with a value. (rhs): Don't invoke grammar_current_rule_action_append. (action): Invoke it here instead. * src/reader.c (grammar_midrule_action): Now extern. (grammar_current_rule_action_append): Don't invoke grammar_midrule_action; that is now the scanner's job. * src/reader.h (last_string, last_braced_code_loc): (grammar_midrule_action): New decls. * src/scan-gram.l (last_string): Now extern, sigh. (last_braced_code_loc): New extern variable. (<INITIAL>"{"): Invoke grammar_midrule_action if the current rule already has an action. (<SC_BRACED_CODE>"}"): Set last_braced_code_loc before returning. * tests/input.at (AT_CHECK_UNUSED_VALUES): Add some tests to check that the above changes fixed the bug.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* Input parser for Bison
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -38,6 +39,8 @@ typedef struct merger_list
|
||||
extern FILE *gram_in;
|
||||
extern int gram__flex_debug;
|
||||
extern boundary scanner_cursor;
|
||||
extern char *last_string;
|
||||
extern location last_braced_code_loc;
|
||||
extern int max_left_semantic_context;
|
||||
void scanner_initialize (void);
|
||||
void scanner_free (void);
|
||||
@@ -63,6 +66,7 @@ void grammar_start_symbol_set (symbol *sym, location loc);
|
||||
void prologue_augment (const char *prologue, location loc);
|
||||
void grammar_current_rule_begin (symbol *lhs, location loc);
|
||||
void grammar_current_rule_end (location loc);
|
||||
void grammar_midrule_action (void);
|
||||
void grammar_current_rule_prec_set (symbol *precsym, location loc);
|
||||
void grammar_current_rule_dprec_set (int dprec, location loc);
|
||||
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
||||
|
||||
Reference in New Issue
Block a user