mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
c++: support absolute api.location.file names
In the case a user wants to create location.hh elsewhere, it can be helpful to define api.location.file to some possibly absolute path such as -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"'. Currently this does not work with `-o foo/parser.cc`, as we join foo/ and $(top_srcdir) together, the latter starting with slash. We should not try to do that in m4, manipulating file names is quite complex when you through Windows file name in. Let m4 delegate this to gnulib. * src/scan-skel.l (at_output): Accept up to two arguments. * data/bison.m4 (b4_output): Adjust. * tests/skeletons.at (Fatal errors but M4 continues producing output): Adjust to keep the error. * data/location.cc, data/stack.hh: Leave the concatenation to @output. * tests/output.at: Exercise api.location.file with an absolute path.
This commit is contained in:
@@ -29,8 +29,9 @@
|
||||
#define FLEX_PREFIX(Id) skel_ ## Id
|
||||
#include <src/flex-scanner.h>
|
||||
|
||||
#include <dirname.h>
|
||||
#include <error.h>
|
||||
#include <dirname.h>
|
||||
#include <path-join.h>
|
||||
#include <quotearg.h>
|
||||
|
||||
#include <src/complain.h>
|
||||
@@ -236,14 +237,14 @@ at_complain (int argc, char *argv[], char **out_namep, int *out_linenop)
|
||||
static void
|
||||
at_output (int argc, char *argv[], char **out_namep, int *out_linenop)
|
||||
{
|
||||
if (2 < argc)
|
||||
if (3 < argc)
|
||||
fail_for_at_directive_too_many_args (argv[0]);
|
||||
if (*out_namep)
|
||||
{
|
||||
free (*out_namep);
|
||||
xfclose (yyout);
|
||||
}
|
||||
*out_namep = xstrdup (argv[1]);
|
||||
*out_namep = xpath_join (argv[1], 2 < argc ? argv[2] : NULL);
|
||||
output_file_name_check (out_namep, true);
|
||||
/* If there were errors, do not generate the output. */
|
||||
yyout = xfopen (complaint_status ? "/dev/null" : *out_namep, "w");
|
||||
|
||||
Reference in New Issue
Block a user