mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
lalr1.cc: don't generate location.hh when location_type is defined
* data/bison.m4 (b4_percent_define_use): New.
(b4_percent_define_get): Use it.
Accept a default value.
* data/c++.m4: Do not provide a default value for the %define
variable location_type, rather, use b4_percent_define_get with a
default argument where its value is needed.
* data/lalr1.cc: Do not load location.cc (which outputs both
location.hh and position.hh) if the user defined location_type.
Do not include location.hh either.
* data/glr.cc: Likewise.
(cherry picked from commit 7789b6e3e7)
Conflicts:
ChangeLog
data/bison.m4
data/c++.m4
data/lalr1.cc
This commit is contained in:
@@ -361,10 +361,26 @@ m4_popdef([b4_start])dnl
|
||||
m4_popdef([b4_end])dnl
|
||||
])])
|
||||
|
||||
# b4_percent_define_get(VARIABLE)
|
||||
|
||||
|
||||
|
||||
## --------------------- ##
|
||||
## b4_percent_define_*. ##
|
||||
## --------------------- ##
|
||||
|
||||
|
||||
# b4_percent_define_use(VARIABLE)
|
||||
# -------------------------------
|
||||
# Mimic muscle_percent_define_get in ../src/muscle-tab.h exactly. That is, if
|
||||
# the %define variable VARIABLE is defined, emit its value. Also, record
|
||||
# Declare that VARIABLE was used.
|
||||
m4_define([b4_percent_define_use],
|
||||
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
||||
])
|
||||
|
||||
# b4_percent_define_get(VARIABLE, [DEFAULT])
|
||||
# ------------------------------------------
|
||||
# Mimic muscle_percent_define_get in ../src/muscle-tab.h. That is, if
|
||||
# the %define variable VARIABLE is defined, emit its value. Contrary
|
||||
# to its C counterpart, return DEFAULT otherwise. Also, record
|
||||
# Bison's usage of VARIABLE by defining
|
||||
# b4_percent_define_bison_variables(VARIABLE).
|
||||
#
|
||||
@@ -372,8 +388,11 @@ m4_popdef([b4_end])dnl
|
||||
#
|
||||
# b4_percent_define_get([[foo]])
|
||||
m4_define([b4_percent_define_get],
|
||||
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
||||
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
|
||||
[b4_percent_define_use([$1])dnl
|
||||
m4_ifdef([b4_percent_define(]$1[)],
|
||||
[m4_indir([b4_percent_define(]$1[)])],
|
||||
[$2])])
|
||||
|
||||
|
||||
# b4_percent_define_get_loc(VARIABLE)
|
||||
# -----------------------------------
|
||||
|
||||
Reference in New Issue
Block a user