mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: provide a means to control how location.hh is included
Users may want to generate the location file elsewhere, say $top_srcdir/include/ast/location.hh. Yet, we should not generate `#include "$top_srcdir/include/ast/location.hh"` but probably something like `#include <ast/location.hh>`, or `#include "ast/location.hh", or `#include <location.hh>`. It entirely depends on the compiler flags (-I/-isystem) that are used. Bison cannot guess what is expected, so let's give the user a means to tell how the location file should be included. * data/location.cc (b4_location_file): New. * data/glr.cc, data/lalr1.cc: Use it.
This commit is contained in:
@@ -247,7 +247,7 @@ b4_percent_code_get([[requires]])[
|
||||
#include <string>
|
||||
|
||||
]m4_ifdef([b4_location_file],
|
||||
[[# include "]b4_location_file["]])[
|
||||
[[# include ]b4_location_include])[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
|
||||
@@ -163,8 +163,8 @@ m4_define([b4_shared_declarations],
|
||||
# include <vector>
|
||||
|
||||
]b4_cxx_portability[
|
||||
]m4_ifdef([b4_location_file],
|
||||
[[# include "]b4_location_file["]])[
|
||||
]m4_ifdef([b4_location_include],
|
||||
[[# include ]b4_location_include])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
|
||||
@@ -37,8 +37,12 @@ b4_percent_define_ifdef([[api.position.file]],
|
||||
b4_percent_define_check_file([b4_location_file],
|
||||
[[api.location.file]],
|
||||
b4_defines_if([[location.hh]]))
|
||||
|
||||
|
||||
# If location.hh is to be generated, the name under which should it be
|
||||
# included.
|
||||
m4_ifdef([b4_location_file],
|
||||
[m4_define([b4_location_include],
|
||||
[b4_percent_define_get([[api.location.include]],
|
||||
["b4_location_file"])])])
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
@@ -317,7 +321,7 @@ m4_ifdef([b4_position_file], [[
|
||||
// 3. remove references to this file from your build system
|
||||
// 4. if you used to include it, include "]b4_location_file[" instead.
|
||||
|
||||
#include "]b4_location_file["
|
||||
#include ]b4_location_include[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user