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:
Akim Demaille
2018-10-05 08:27:11 +02:00
parent 50b8d4ba5a
commit 5fe636c7ee
4 changed files with 89 additions and 6 deletions

View File

@@ -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[