Treat %error-verbose as %define error_verbose.

This allows to pass -Derror_verbose on the command line.  Better yet, it
allows to pass -Derror_verbose=$(ERROR_VERBOSE), with ERROR_VERBOSE being
defined as false or true.

	* data/bison.m4 (b4_percent_define_if_define): Instead of relying
	on b4_percent_define_ifdef, for does not check the defined value,
	but only whether the symbol is defined, rely on
	b4_percent_define_flag_if, so that a value of "false" is processed
	as a false.
	If not defined, define the flag to "false".
	(b4_error_verbose_if): New.
	* data/glr.c, data/lalr1.cc, data/yacc.c: Use it instead of
	b4_error_verbose_flag.
	* src/getargs.h, src/getargs.c (error_verbose_flag): Remove.
	* src/output.c (prepare): Don't output it.
	* src/parse-gram.y (%error-verbose): Treat as %define error_verbose.
This commit is contained in:
Akim Demaille
2009-04-03 00:18:47 +02:00
parent 92822affc5
commit b3a2272a73
8 changed files with 40 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
/* Parse command line arguments for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -56,8 +56,6 @@ bool no_lines_flag;
bool token_table_flag;
bool yacc_flag; /* for -y */
bool error_verbose = false;
bool nondeterministic_parser = false;
bool glr_parser = false;

View File

@@ -1,7 +1,7 @@
/* Parse command line arguments for bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -44,8 +44,6 @@ extern bool no_lines_flag; /* for -l */
extern bool token_table_flag; /* for -k */
extern bool yacc_flag; /* for -y */
extern bool error_verbose;
/* GLR_PARSER is true if the input file says to use the GLR
(Generalized LR) parser, and to output some additional information

View File

@@ -1,7 +1,7 @@
/* Output the generated parsing program for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -702,7 +702,6 @@ prepare (void)
/* Flags. */
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);

View File

@@ -1,6 +1,6 @@
%{/* Bison Grammar Parser -*- C -*-
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -236,7 +236,10 @@ prologue_declaration:
defines_flag = true;
spec_defines_file = xstrdup ($2);
}
| "%error-verbose" { error_verbose = true; }
| "%error-verbose"
{
muscle_percent_define_insert ("error_verbose", @$, "");
}
| "%expect" INT { expected_sr_conflicts = $2; }
| "%expect-rr" INT { expected_rr_conflicts = $2; }
| "%file-prefix" STRING { spec_file_prefix = $2; }