mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
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:
@@ -332,7 +332,6 @@ m4_define([b4_$3_if],
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||||
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
|
||||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
b4_define_flag_if([locations]) # Whether locations are tracked.
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
@@ -619,30 +618,11 @@ m4_define([b4_percent_define_ifdef],
|
|||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_if_define(VARIABLE)
|
|
||||||
# -------------------------------------
|
|
||||||
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether VARIABLE
|
|
||||||
# was %defined.
|
|
||||||
m4_define([b4_percent_define_if_define_],
|
|
||||||
[m4_define([b4_$1_if], [b4_percent_define_ifdef([$1], [$2], [$3])])])
|
|
||||||
m4_define([b4_percent_define_if_define],
|
|
||||||
[b4_percent_define_if_define_([$1], $[1], $[2])])
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
## Options. ##
|
## Options. ##
|
||||||
## --------- ##
|
## --------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
|
||||||
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
|
||||||
# ----------------------------------------------
|
|
||||||
b4_percent_define_if_define([assert])
|
|
||||||
b4_percent_define_if_define([lex_symbol])
|
|
||||||
b4_percent_define_if_define([variant])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
||||||
@@ -666,6 +646,7 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])])
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT)
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
||||||
@@ -684,6 +665,30 @@ m4_define([b4_percent_define_default],
|
|||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_percent_define_if_define(VARIABLE)
|
||||||
|
# -------------------------------------
|
||||||
|
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether
|
||||||
|
# VARIABLE was %defined.
|
||||||
|
m4_define([b4_percent_define_if_define_],
|
||||||
|
[m4_define([b4_$1_if], [b4_percent_define_flag_if([$1], [$2], [$3])])])
|
||||||
|
m4_define([b4_percent_define_if_define],
|
||||||
|
[b4_percent_define_default([[$1]], [[false]])
|
||||||
|
b4_percent_define_if_define_([$1], $[1], $[2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||||
|
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
||||||
|
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
||||||
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
|
# ----------------------------------------------
|
||||||
|
b4_percent_define_if_define([assert])
|
||||||
|
b4_percent_define_if_define([error_verbose])
|
||||||
|
b4_percent_define_if_define([lex_symbol])
|
||||||
|
b4_percent_define_if_define([variant])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Mimic muscle_percent_define_check_values in ../src/muscle_tab.h exactly
|
# Mimic muscle_percent_define_check_values in ../src/muscle_tab.h exactly
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -116,7 +116,7 @@ m4_popdef([b4_dollar_dollar])dnl
|
|||||||
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002, 2003, 2004, 2005, 2006, 2007, 2008])
|
[2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009])
|
||||||
|
|
||||||
m4_define([b4_parser_class_name],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[parser_class_name]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
@@ -169,7 +169,7 @@ dnl FIXME: This is wrong, we want computed header guards.
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||||
# 2007, 2008 Free Software Foundation, Inc.
|
# 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008])
|
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009])
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -200,7 +200,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
/* Enabling the token table. */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Parse command line arguments for Bison.
|
/* Parse command line arguments for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
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.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -56,8 +56,6 @@ bool no_lines_flag;
|
|||||||
bool token_table_flag;
|
bool token_table_flag;
|
||||||
bool yacc_flag; /* for -y */
|
bool yacc_flag; /* for -y */
|
||||||
|
|
||||||
bool error_verbose = false;
|
|
||||||
|
|
||||||
bool nondeterministic_parser = false;
|
bool nondeterministic_parser = false;
|
||||||
bool glr_parser = false;
|
bool glr_parser = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Parse command line arguments for bison.
|
/* Parse command line arguments for bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
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.
|
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 token_table_flag; /* for -k */
|
||||||
extern bool yacc_flag; /* for -y */
|
extern bool yacc_flag; /* for -y */
|
||||||
|
|
||||||
extern bool error_verbose;
|
|
||||||
|
|
||||||
|
|
||||||
/* GLR_PARSER is true if the input file says to use the GLR
|
/* GLR_PARSER is true if the input file says to use the GLR
|
||||||
(Generalized LR) parser, and to output some additional information
|
(Generalized LR) parser, and to output some additional information
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Output the generated parsing program for Bison.
|
/* Output the generated parsing program for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
|
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.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -702,7 +702,6 @@ prepare (void)
|
|||||||
/* Flags. */
|
/* Flags. */
|
||||||
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
||||||
MUSCLE_INSERT_BOOL ("defines_flag", defines_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 ("glr_flag", glr_parser);
|
||||||
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
|
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
|
||||||
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
%{/* Bison Grammar Parser -*- C -*-
|
%{/* 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.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -236,7 +236,10 @@ prologue_declaration:
|
|||||||
defines_flag = true;
|
defines_flag = true;
|
||||||
spec_defines_file = xstrdup ($2);
|
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" INT { expected_sr_conflicts = $2; }
|
||||||
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
||||||
| "%file-prefix" STRING { spec_file_prefix = $2; }
|
| "%file-prefix" STRING { spec_file_prefix = $2; }
|
||||||
|
|||||||
Reference in New Issue
Block a user