mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
options: rename --defines as --header
The name "defines" is incorrect, the generated file contains far more than just #defines. * src/getargs.h, src/getargs.c (-H, --header): New option. With optional argument, just like --defines, --xml, etc. (defines_flag): Rename as... (header_flag): this. Adjust dependencies. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, * data/skeletons/glr.cc, data/skeletons/glr2.cc, data/skeletons/lalr1.cc, * data/skeletons/yacc.c: Adjust. * examples, doc/bison.texi: Adjust. * tests/headers.at, tests/local.at, tests/output.at: Convert most tests from using --defines to using --header.
This commit is contained in:
@@ -391,9 +391,9 @@ m4_define([b4_$3_if],
|
||||
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||
# -----------------------------
|
||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||
b4_define_flag_if([has_translations]) # Whether some tokens are internationalized.
|
||||
b4_define_flag_if([header]) # Whether a header is requested.
|
||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||
|
||||
@@ -953,7 +953,7 @@ struct ]b4_api_PREFIX[LTYPE
|
||||
|
||||
# b4_declare_yylstype
|
||||
# -------------------
|
||||
# Declarations that might either go into the header (if --defines) or
|
||||
# Declarations that might either go into the header (if --header) or
|
||||
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
||||
m4_define([b4_declare_yylstype],
|
||||
[b4_value_type_define[]b4_locations_if([
|
||||
|
||||
@@ -151,7 +151,7 @@ m4_define([b4_rhs_location],
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# Declaration that might either go into the header (if --header)
|
||||
# or open coded in the parser body. glr.cc has its own definition.
|
||||
m4_if(b4_skeleton, ["glr.c"],
|
||||
[m4_define([b4_shared_declarations],
|
||||
@@ -185,7 +185,7 @@ int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)],
|
||||
|
||||
# glr.cc produces its own header.
|
||||
b4_glr_cc_if([],
|
||||
[b4_defines_if(
|
||||
[b4_header_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
[2002-2015, 2018-2020])[
|
||||
@@ -228,7 +228,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||
]b4_cast_define[
|
||||
]b4_null_define[
|
||||
|
||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
[b4_shared_declarations])[
|
||||
|
||||
]b4_glr_cc_if([b4_glr_cc_setup],
|
||||
|
||||
@@ -281,7 +281,7 @@ b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# Declaration that might either go into the header (if --header, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
@@ -378,7 +378,7 @@ b4_percent_code_get([[requires]])[
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
])[
|
||||
|
||||
]b4_defines_if(
|
||||
]b4_header_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015, 2018-2020])[
|
||||
|
||||
@@ -101,7 +101,7 @@ m4_define([b4_glr_cc_cleanup],
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# Declaration that might either go into the header (if --header, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
@@ -317,7 +317,7 @@ const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX =
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
])[
|
||||
|
||||
]b4_defines_if(
|
||||
]b4_header_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015, 2018-2020])[
|
||||
@@ -491,7 +491,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
[b4_shared_declarations])[
|
||||
|
||||
]b4_glr_cc_setup[
|
||||
|
||||
@@ -174,7 +174,7 @@ b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])])
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# Declaration that might either go into the header (if --header, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_percent_code_get([[requires]])[
|
||||
@@ -500,7 +500,7 @@ m4_define([b4_shared_declarations],
|
||||
## Output files. ##
|
||||
## -------------- ##
|
||||
|
||||
b4_defines_if(
|
||||
b4_header_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
||||
[
|
||||
@@ -530,7 +530,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
|
||||
]b4_user_pre_prologue[
|
||||
|
||||
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
|
||||
[b4_shared_declarations([cc])])[
|
||||
|
||||
]b4_user_post_prologue[
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
m4_include(b4_skeletonsdir/[java.m4])
|
||||
|
||||
b4_defines_if([b4_complain([%defines does not make sense in Java])])
|
||||
b4_header_if([b4_complain([%defines does not make sense in Java])])
|
||||
|
||||
m4_define([b4_symbol_no_destructor_assert],
|
||||
[b4_symbol_if([$1], [has_destructor],
|
||||
|
||||
@@ -22,7 +22,7 @@ m4_pushdef([b4_copyright_years],
|
||||
# b4_position_file
|
||||
# ----------------
|
||||
# Name of the file containing the position class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
b4_header_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_position_file], [position.hh])])])])
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ b4_defines_if([b4_required_version_if([302], [],
|
||||
# if we want this file.
|
||||
b4_percent_define_check_file([b4_location_file],
|
||||
[[api.location.file]],
|
||||
b4_defines_if([[location.hh]]))
|
||||
b4_header_if([[location.hh]]))
|
||||
|
||||
# b4_location_include
|
||||
# -------------------
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
# b4_stack_file
|
||||
# -------------
|
||||
# Name of the file containing the stack class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
b4_header_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_stack_file], [stack.hh])])])
|
||||
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ m4_define([b4_declare_yyparse],
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# Declaration that might either go into the header (if --header)
|
||||
# or open coded in the parser body.
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||
@@ -330,13 +330,13 @@ m4_if(b4_spec_header_file, [y.tab.h], [],
|
||||
## -------------- ##
|
||||
|
||||
|
||||
b4_defines_if([[
|
||||
b4_header_if([[
|
||||
]b4_output_begin([b4_spec_header_file])[
|
||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||
]b4_disclaimer[
|
||||
]b4_shared_declarations[
|
||||
]b4_output_end[
|
||||
]])# b4_defines_if
|
||||
]])# b4_header_if
|
||||
|
||||
b4_output_begin([b4_parser_file_name])[
|
||||
]b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||
|
||||
Reference in New Issue
Block a user