c++: make stack.hh completely useless

Let's completely deprecate stack.hh.  Don't provide a means to give it
a new name, allow only its removal.

See https://lists.gnu.org/archive/html/bison-patches/2018-09/msg00151.html
and https://lists.gnu.org/archive/html/bison-patches/2018-09/msg00182.html.

* data/stack.hh: Reduce stack.hh to a simple comment explaining how to
get rid of it.
* data/lalr1.cc: Adjust
* tests/input.at (%define file variables): Adjust.
* tests/output.at: Remove cases where stack.hh was removed.
This commit is contained in:
Akim Demaille
2018-10-02 07:01:13 +02:00
parent 667588ee8a
commit 29b1da4e18
5 changed files with 17 additions and 38 deletions

View File

@@ -163,8 +163,6 @@ m4_define([b4_shared_declarations],
# include <vector> # include <vector>
]b4_cxx_portability[ ]b4_cxx_portability[
]m4_ifdef([b4_stack_file],
[[# include "]b4_stack_file["]])[
]m4_ifdef([b4_position_file], ]m4_ifdef([b4_position_file],
[[# include "]b4_position_file["]])[ [[# include "]b4_position_file["]])[
]m4_ifdef([b4_location_file], ]m4_ifdef([b4_location_file],
@@ -178,7 +176,7 @@ m4_define([b4_shared_declarations],
]b4_namespace_open[ ]b4_namespace_open[
]m4_ifndef([b4_stack_file], [b4_stack_define])[ ]b4_stack_define[
]b4_bison_locations_if([m4_ifndef([b4_location_file], ]b4_bison_locations_if([m4_ifndef([b4_location_file],
[m4_ifndef([b4_position_file], [b4_position_define [m4_ifndef([b4_position_file], [b4_position_define

View File

@@ -15,15 +15,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years],
[2002-2015, 2018])
# b4_stack_file # b4_stack_file
# ------------- # -------------
# Name of the file containing the stack class, if we want this file. # Name of the file containing the stack class, if we want this file.
b4_percent_define_check_file([b4_stack_file], b4_percent_define_ifdef([[api.stack.file]],
[[api.stack.file]], [b4_percent_define_check_values([[[[api.stack.file]],
b4_defines_if([[stack.hh]])) [[none]]]])],
[b4_defines_if([m4_define([b4_stack_file], [stack.hh])])])
# b4_stack_define # b4_stack_define
@@ -140,25 +139,13 @@ m4_define([b4_stack_define],
m4_ifdef([b4_stack_file], m4_ifdef([b4_stack_file],
[b4_output_begin([b4_dir_prefix[]b4_stack_file])[ [b4_output_begin([b4_dir_prefix[]b4_stack_file])[
]b4_copyright([Stack handling for Bison parsers in C++])[ // Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined with the parser itself.
//
// To get rid of this file:
// 1. add '%define api.stack.file none' to your grammar file
// 2. add 'require "3.2"' to your grammar file
// 3. remove references to this file from your build system.
/**
** \file ]b4_dir_prefix[]b4_stack_file[
** Define the ]b4_namespace_ref[::stack class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]b4_stack_file])[
# include <vector>
]b4_cxx_portability[
]b4_namespace_open[
]b4_stack_define[
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]b4_stack_file])[
]b4_output_end[ ]b4_output_end[
]]) ]])
m4_popdef([b4_copyright_years])

View File

@@ -694,10 +694,8 @@ AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %
AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_LALR1_CC([%locations %define api.stack.file "my-stack.hh"])
AT_CHECK_CALC_LALR1_CC([%locations %defines %define api.stack.file none %define api.location.file none %define api.position.file none]) AT_CHECK_CALC_LALR1_CC([%locations %defines %define api.stack.file none %define api.location.file none %define api.position.file none])
AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.stack.file "my-stack.hh"]) AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.stack.file none %define api.position.file none %define api.location.file "my-location.hh"])
AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.stack.file "my-stack.hh" %define api.position.file none %define api.location.file "my-location.hh"])
# --------------------------- # # --------------------------- #

View File

@@ -1673,9 +1673,10 @@ AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
input.y:4.9-25: error: %define variable 'api.location.file' requires 'none' or '"..."' values input.y:4.9-25: error: %define variable 'api.location.file' requires 'none' or '"..."' values
%define api.location.file {bogus} %define api.location.file {bogus}
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
input.y:3.9-22: error: %define variable 'api.stack.file' requires 'none' or '"..."' values input.y:3.9-22: error: invalid value for %define variable 'api.stack.file': 'bogus'
%define api.stack.file bogus %define api.stack.file bogus
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
input.y:3.9-22: accepted value: 'none'
]]) ]])
AT_CLEANUP AT_CLEANUP

View File

@@ -180,11 +180,6 @@ AT_CHECK_OUTPUT([gram_dir/foo.yy],
[output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh]) [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh])
# api.stack.file. # api.stack.file.
AT_CHECK_OUTPUT([foo.yy],
[%skeleton "lalr1.cc" %define api.stack.file "foo.sta.hh"],
[],
[foo.sta.hh foo.tab.cc])
AT_CHECK_OUTPUT([foo.yy], AT_CHECK_OUTPUT([foo.yy],
[%skeleton "lalr1.cc" %defines %define api.stack.file none], [%skeleton "lalr1.cc" %defines %define api.stack.file none],
[], [],
@@ -216,9 +211,9 @@ AT_CHECK_OUTPUT([foo.yy],
[foo.loc.hh foo.pos.hh foo.tab.cc foo.tab.hh]) [foo.loc.hh foo.pos.hh foo.tab.cc foo.tab.hh])
AT_CHECK_OUTPUT([gram_dir/foo.yy], AT_CHECK_OUTPUT([gram_dir/foo.yy],
[%skeleton "lalr1.cc" %verbose %defines %define api.stack.file "foo.sta.hh" %file-prefix "output_dir/foo"], [%skeleton "lalr1.cc" %verbose %defines %file-prefix "output_dir/foo"],
[], [],
[output_dir/foo.output output_dir/foo.sta.hh output_dir/foo.tab.cc output_dir/foo.tab.hh]) [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh])
# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR, # AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,