mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: provide control over the stack.hh file name
It was not a good idea to generate the file stack.hh. It never was. But now we have to deal with backward compatibility: if we stop generating it, the build system of some build system will probably break. So offer the user a means to (i) decide what the name of the output file should be, and (ii) not generate this file at all (its content will be inline where the parser is defined). * data/lalr1.cc (b4_percent_define_check_file_complain) (b4_percent_define_check_file): New. * data/stack.hh: Generate the file only if api.stack.file is not empty. In that case, use it as file name. * data/lalr1.cc: Adjust to include the right file, or to include the definition of stack. * tests/calc.at, tests/output.at: Exercise api.stack.file.
This commit is contained in:
@@ -20,6 +20,7 @@ m4_include(b4_pkgdatadir/[c++.m4])
|
||||
# api.value.type=variant is valid.
|
||||
m4_define([b4_value_type_setup_variant])
|
||||
|
||||
|
||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||
# --------------------------------------------------------------
|
||||
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
||||
@@ -162,8 +163,9 @@ m4_define([b4_shared_declarations],
|
||||
# include <vector>
|
||||
|
||||
]b4_cxx_portability[
|
||||
]m4_ifdef([b4_stack_file],
|
||||
[[# include "]b4_stack_file["]])[
|
||||
]b4_defines_if([[
|
||||
# include "stack.hh"
|
||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
@@ -174,9 +176,9 @@ m4_define([b4_shared_declarations],
|
||||
|
||||
]b4_namespace_open[
|
||||
|
||||
]m4_ifdef([b4_stack_file], [], [b4_stack_define])[
|
||||
]b4_defines_if([],
|
||||
[b4_stack_define
|
||||
b4_bison_locations_if([b4_position_define
|
||||
[b4_bison_locations_if([b4_position_define
|
||||
b4_location_define])])[
|
||||
|
||||
]b4_variant_if([b4_variant_define])[
|
||||
|
||||
Reference in New Issue
Block a user