summaryrefslogtreecommitdiff
path: root/src/getargs.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-09-06 13:30:23 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-09-19 08:31:49 +0200
commit75c3746ce287f9ba3ee5d8c60e2961be72b544f0 (patch)
tree04dbba24bfc5f9b436f7d4ab19c9d55a3ac50681 /src/getargs.c
parentb329f0b5dfb97b974b2b38d571f631deac5f7aba (diff)
downloadbison-75c3746ce287f9ba3ee5d8c60e2961be72b544f0.tar.gz
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.
Diffstat (limited to 'src/getargs.c')
-rw-r--r--src/getargs.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/getargs.c b/src/getargs.c
index a15c07b5..df2c6da1 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -38,7 +38,7 @@
#include "output.h"
#include "uniqstr.h"
-bool defines_flag = false;
+bool header_flag = false;
bool graph_flag = false;
bool xml_flag = false;
bool no_lines_flag = false;
@@ -422,11 +422,9 @@ Tuning the Parser:\n\
"), stdout);
putc ('\n', stdout);
- /* Keep -d and --defines separate so that ../build-aux/cross-options.pl
- * won't assume that -d also takes an argument. */
fputs (_("\
Output Files:\n\
- --defines[=FILE] also produce a header file\n\
+ -H, --header=[FILE] also produce a header file\n\
-d likewise but cannot specify FILE (for POSIX Yacc)\n\
-r, --report=THINGS also produce details on the automaton\n\
--report-file=FILE write report to FILE\n\
@@ -545,6 +543,7 @@ language_argmatch (char const *arg, int prio, location loc)
static char const short_options[] =
"D:"
"F:"
+ "H::"
"L:"
"S:"
"T::"
@@ -609,6 +608,7 @@ static struct option const long_options[] =
{ "yacc", no_argument, 0, 'y' },
/* Output Files. */
+ { "header", optional_argument, 0, 'H' },
{ "defines", optional_argument, 0, 'd' },
{ "report", required_argument, 0, 'r' },
{ "report-file", required_argument, 0, REPORT_FILE_OPTION },
@@ -719,6 +719,16 @@ getargs (int argc, char *argv[])
}
break;
+ case 'H':
+ case 'd':
+ header_flag = true;
+ if (optarg)
+ {
+ free (spec_header_file);
+ spec_header_file = xstrdup (optarg);
+ }
+ break;
+
case 'L':
language_argmatch (optarg, command_line_prio, loc);
break;
@@ -763,16 +773,6 @@ getargs (int argc, char *argv[])
spec_file_prefix = optarg;
break;
- case 'd':
- /* Here, the -d and --defines options are differentiated. */
- defines_flag = true;
- if (optarg)
- {
- free (spec_header_file);
- spec_header_file = xstrdup (optarg);
- }
- break;
-
case 'g':
graph_flag = true;
if (optarg)