bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Implement clean output file naming rules for %language.


From: Joel E. Denny
Subject: [PATCH] Implement clean output file naming rules for %language.
Date: Fri, 31 Oct 2008 17:29:23 -0400 (EDT)

On Tue, 7 Oct 2008, Joel E. Denny wrote:

> Di-an's email has prompted me to change the way Bison computes output file 
> names.  I'd appreciate any opinions from other developers as well on this 
> issue.  I feel we need to settle it before the 2.4 release so we don't 
> find ourselves stuck with more backward compatibility problems.

I didn't realize how difficult this would be until I got into it.  This is 
a significant change that could affect many people, so it really needs one 
more pair of eyes at the very least.

To begin reviewing it, I recommend reading the Bison manual section it 
adds, `Output Files'.  The basic idea is that the old output file naming 
rules are cumbersome especially as Bison is beginning to support new 
output languages.  We should encourage people to use %language, which, 
after this patch, will activate a simplified and more general set of 
naming rules.  Thus, the change is not backward compatible with 2.3b, but 
it is backward compatible with 2.3 because %language did not exist then.

I think it would be cleaner if we could change %skeleton to activate the 
new naming rules as well.  However, I worry this might break makefiles for 
users who have already been using %skeleton "lalr1.cc", so I didn't do 
that.  But I'm open to it if others think this isn't an issue.

There are a couple of additional advantages after this patch.  First, new 
skeletons can specify default output file name extensions without 
rebuilding Bison.  Second, skeleton selection could be easily moved 
completely into the back-end in a single m4 file.  I believe this would 
simplify the skeleton selection implementation, and it would avoid a 
recompile of Bison when skeleton selection needs to be configured for a 
new language.  I'm out of time and can't write a patch for that at the 
moment.

Not yet committed.

>From dd4d4fd59763893d1b6a2167b80d819a6fe95576 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 31 Oct 2008 16:43:16 -0400
Subject: [PATCH] Implement clean output file naming rules for %language.

* NEWS: Mention.
* data/bison.m4 (b4_compute_parser_file_name): New.
(b4_compute_defines_file_name): New.
* data/yacc.c: Use those so you can specify the default file name
extensions here.
* data/glr.c: Likewise.
* data/glr.cc: Likewise.
* data/lalr1.cc: Likewise.
* data/lalr1.java: Likewise.
* doc/bison.texinfo (Decl Summary): Cross reference the new Output
Files section and make some other minor improvements.
(Understanding): Likewise.
(Invocation): Move output file naming explanation to...
(Output Files): ... this new subsection and expand to explain new and
old output file naming logic.
(Bison Options): Cross reference the new Output Files section and make
some other minor improvements.
* src/files.c (defines_file_name): New global similar to
parser_file_name.  Initialize both to NULL because they might not ever
be assigned when the skeletons are allowed to choose the file name
extensions.
(compute_exts_from_gf): Revert to pre-%language behavior.
(compute_file_name_parts_new): New function extracting the logic
from...
(compute_file_name_parts): ... here that is relevant to the new output
file naming logic.  Rename this to...
(compute_file_name_parts_old): ... this and revert to pre-%language
behavior.
(compute_output_file_names): Extend to support the new logic.  Set
defines_file_name rather than overwriting spec_defines_file.
(output_file_names_free): Free defines_file_name rather than
spec_defines_file, which is a const pointer now.
* src/files.h: (defines_file_name): New extern.
(spec_defines_file): Make it a const pointer.
* src/getargs.c (valid_languages): Remove fields for file name
extensions.  The skeletons handle that now.
(skeleton_prio): Use default_prio rather than 2.
(language_prio): Likewise, and remove static qualifier because files.c
needs to see it now.
(getargs): Don't xstrdup for spec_defines_file.  It's const now.
Use command_line_prio rather than 0.
* src/getargs.h (bison_language): Remove fields for file name
extensions.
(command_line_prio, grammar_prio, default_prio): New enum fields.
(language_prio): Extern it.
* src/output.c (prepare): Define b4_defines_file_name muscle.
* src/parse-gram.y: Don't xstrdup for spec_defines_file.
Use grammar_prio rather than 1.
* tests/output.at (AT_CHECK_OUTPUT): Use conventional m4 quoting when
expanding arguments.
(Output files): Add tests for the new output file naming logic.

diff --git a/NEWS b/NEWS
index 53334d6..9e42e0a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,14 @@ Bison News
 
 Changes in version ?.? (????-??-??):
 
-*
+* %language versus %skeleton
+
+  The effect of %language on the names of output files has widened.  It now
+  activates a set of simplified naming rules that is more appropriate as Bison
+  evolves to handle new output languages.  This new behavior is an additional
+  reason that we recommend using %language instead of %skeleton to select
+  official Bison skeletons.  See the new section `Output Files' in the Bison
+  manual for details.
 
 Changes in version 2.3b (2008-05-27):
 
diff --git a/data/bison.m4 b/data/bison.m4
index bad6296..f5ec6af 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -254,9 +254,28 @@ b4_define_flag_if([nondeterministic])      # Whether 
conflicts should be handled.
 b4_define_flag_if([yacc])              # Whether POSIX Yacc is emulated.
 
 
-## ------------------------- ##
-## Assigning token numbers.  ##
-## ------------------------- ##
+# b4_compute_parser_file_name(DEFAULT_EXT)
+# ----------------------------------------
+# Compute the parser source code file name using the default extension
+# DEFAULT_EXT.  For example:
+#
+#   b4_compute_parser_file_name([[.c]])
+m4_define([b4_compute_parser_file_name],
+[m4_ifval(b4_spec_outfile, [b4_spec_outfile],
+          [m4_ifval(b4_parser_file_name, [b4_parser_file_name],
+                    [b4_file_name_all_but_ext[]$1])])])
+
+# b4_compute_defines_file_name(DEFAULT_EXT)
+# -----------------------------------------
+# Compute the parser header file name using the default extension DEFAULT_EXT.
+# For example:
+#
+#   b4_compute_defines_file_name([[.h]])
+m4_define([b4_compute_defines_file_name],
+[m4_ifval(b4_spec_defines_file, [b4_spec_defines_file],
+          [m4_ifval(b4_defines_file_name, [b4_defines_file_name],
+                    [b4_file_name_all_but_ext[]$1])])])
+
 
 
 ## ----------- ##
@@ -311,6 +330,11 @@ b4_define_user_code([pre_prologue])
 b4_define_user_code([stype])
 
 
+
+## --------------------------- ##
+## %define and %code support.  ##
+## --------------------------- ##
+
 # b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
 # --------------------------------------------------------
 # Warn if any name of type WHAT is used by the user (as recorded in USER-LIST)
diff --git a/data/glr.c b/data/glr.c
index c6de6d8..63fefb5 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -1,8 +1,8 @@
                                                                     -*- C -*-
 
 # GLR skeleton for Bison
-# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software 
Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
+# Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -148,9 +148,9 @@ m4_define([b4_rhs_location],
 # We do want M4 expansion after # for CPP macros.
 m4_changecom()
 m4_divert_push(0)dnl
address@hidden(b4_parser_file_name@)
address@hidden(b4_compute_parser_file_name([[.c]])@)
 b4_copyright([Skeleton implementation for Bison GLR parsers in C],
-  [2002, 2003, 2004, 2005, 2006])
+  [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 [
 /* C GLR parser skeleton written by Paul Hilfinger.  */
 
@@ -211,7 +211,7 @@ typedef struct YYLTYPE
 ]b4_percent_code_get([[provides]])[]dnl
 ])
 
-b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
+b4_defines_if([[#include 
"@basename(]b4_compute_defines_file_name([[.h]])[@)"]],
              [b4_shared_declarations])[
 
 /* Enabling traces.  */
@@ -2637,9 +2637,9 @@ dnl glr.cc produces its own header.
 dnl
 m4_if(b4_skeleton, ["glr.c"],
 [b4_defines_if(
address@hidden(b4_spec_defines_file@)
address@hidden(b4_compute_defines_file_name([[.h]])@)
 b4_copyright([Skeleton interface for Bison GLR parsers in C],
-  [2002, 2003, 2004, 2005, 2006])
+  [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 
 b4_shared_declarations
 
diff --git a/data/glr.cc b/data/glr.cc
index ea04b28..f48e318 100644
--- a/data/glr.cc
+++ b/data/glr.cc
@@ -1,8 +1,8 @@
                                                                     -*- C -*-
 
 # C++ GLR skeleton for Bison
-# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
+# Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -213,13 +213,18 @@ m4_defn([b4_parse_param])))],
 [m4_pushdef([b4_parse_param],
            [[[[b4_namespace_ref::b4_parser_class_name& yyparser], 
[[yyparser]]]]])
 ])
+# Don't let glr.c try to compute the output file names with .c and .h.
+m4_define([b4_parser_file_name],
+          m4_dquote(b4_compute_parser_file_name([[.cc]])))
+m4_define([b4_defines_file_name],
+          m4_dquote(b4_compute_defines_file_name([[.hh]])))
 m4_include(b4_pkgdatadir/[glr.c])
 m4_popdef([b4_parse_param])
 
 m4_divert_push(0)
address@hidden(b4_spec_defines_file@)
address@hidden(b4_compute_defines_file_name([[.hh]])@)
 b4_copyright([Skeleton interface for Bison GLR parsers in C++],
-  [2002, 2003, 2004, 2005, 2006])[
+  [2002, 2003, 2004, 2005, 2006, 2007, 2008])[
 
 /* C++ GLR parser skeleton written by Akim Demaille.  */
 
diff --git a/data/lalr1.cc b/data/lalr1.cc
index ca1dfcc..bb11e82 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -33,7 +33,7 @@ m4_include(b4_pkgdatadir/[location.cc])
 m4_changecom()
 m4_divert_push(0)dnl
 b4_defines_if(
address@hidden(b4_spec_defines_file@)
address@hidden(b4_compute_defines_file_name([[.hh]])@)
 b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
              [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 dnl FIXME: This is wrong, we want computed header guards.
@@ -298,7 +298,7 @@ b4_percent_code_get([[provides]])[]dnl
 
 [#endif /* ! defined PARSER_HEADER_H */]
 ])dnl
address@hidden(b4_parser_file_name@)
address@hidden(b4_compute_parser_file_name([[.cc]])@)
 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
              [2002, 2003, 2004, 2005, 2006, 2007, 2008])
 b4_percent_code_get([[top]])[]dnl
@@ -311,7 +311,7 @@ m4_if(b4_prefix, [yy], [],
 ]b4_user_pre_prologue
 
 b4_defines_if([[
-#include "@basename(]b4_spec_defines_file[@)"]])[
+#include "@basename(]b4_compute_defines_file_name([[.hh]])[@)"]])[
 
 /* User implementation prologue.  */
 ]b4_user_post_prologue
diff --git a/data/lalr1.java b/data/lalr1.java
index 1466b37..78698cb 100644
--- a/data/lalr1.java
+++ b/data/lalr1.java
@@ -23,7 +23,7 @@ m4_ifval(m4_defn([b4_symbol_destructors]),
         [])
 
 m4_divert_push(0)dnl
address@hidden(b4_parser_file_name@)
address@hidden(b4_compute_parser_file_name([[.java]])@)
 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
   [2007, 2008])
 
diff --git a/data/location.cc b/data/location.cc
index 4b79069..11fab9c 100644
--- a/data/location.cc
+++ b/data/location.cc
@@ -21,7 +21,7 @@ m4_changecom()
 m4_divert_push(0)dnl
 @output(b4_dir_prefix[]position.hh@)
 b4_copyright([Positions for Bison parsers in C++],
-  [2002, 2003, 2004, 2005, 2006])[
+  [2002, 2003, 2004, 2005, 2006, 2007])[
 
 /**
  ** \file position.hh
@@ -145,7 +145,7 @@ b4_copyright([Positions for Bison parsers in C++],
 #endif // not BISON_POSITION_HH]
 @output(b4_dir_prefix[]location.hh@)
 b4_copyright([Locations for Bison parsers in C++],
-  [2002, 2003, 2004, 2005, 2006])[
+  [2002, 2003, 2004, 2005, 2006, 2007])[
 
 /**
  ** \file location.hh
diff --git a/data/yacc.c b/data/yacc.c
index 19f77a5..e8dc6e7 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -153,9 +153,9 @@ m4_define([b4_rhs_location],
 # We do want M4 expansion after # for CPP macros.
 m4_changecom()
 m4_divert_push(0)dnl
address@hidden(b4_parser_file_name@)
address@hidden(b4_compute_parser_file_name([[.c]])@)
 b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
-  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[
+  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008])[
 
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
@@ -1674,9 +1674,9 @@ yypushreturn:
 
 ]b4_epilogue
 b4_defines_if(
address@hidden(b4_spec_defines_file@)
address@hidden(b4_compute_defines_file_name([[.h]])@)
 b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
-  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
+  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008])
 
 b4_percent_code_get([[requires]])[]dnl
 
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 5b023fa..a2f63e6 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -282,6 +282,7 @@ Debugging Your Parser
 
 Invoking Bison
 
+* Output Files::      How Bison computes the names of its output files.
 * Bison Options::     All the options described in detail,
                         in alphabetical order by short options.
 * Option Cross Key::  Alphabetical list of long options.
@@ -5029,10 +5030,13 @@ Tokens}.
 If you have declared @code{%code requires} or @code{%code provides}, the output
 header also contains their code.
 @xref{Decl Summary, ,%code}.
+
address@hidden Files}, for details on how the header file name is chosen.
 @end deffn
 
address@hidden {Directive} %defines @var{defines-file}
address@hidden {Directive} %defines "@var{defines-file}"
 Same as above, but save in the file @var{defines-file}.
address@hidden Files}, for further details.
 @end deffn
 
 @deffn {Directive} %destructor
@@ -5043,12 +5047,15 @@ discarded symbols.  @xref{Destructor Decl, , Freeing 
Discarded Symbols}.
 @deffn {Directive} %file-prefix "@var{prefix}"
 Specify a prefix to use for all Bison output file names.  The names are
 chosen as if the input file were named @address@hidden
address@hidden Files}, for further details.
 @end deffn
 
 @deffn {Directive} %language "@var{language}"
 Specify the programming language for the generated parser.  Currently
 supported languages include C, C++, and Java.
 @var{language} is case-insensitive.
address@hidden Files}, for a description of how this also affect the names of
+output files.
 @end deffn
 
 @deffn {Directive} %locations
@@ -5094,6 +5101,7 @@ file in its own right.
 
 @deffn {Directive} %output "@var{file}"
 Specify @var{file} for the parser file.
address@hidden Files}, for further details.
 @end deffn
 
 @deffn {Directive} %pure-parser
@@ -5111,8 +5119,10 @@ Specify the skeleton to use.
 
 You probably don't need this option unless you are developing Bison.
 You should use @code{%language} if you want to specify the skeleton for a
-different language, because it is clearer and because it will always choose the
-correct skeleton for non-deterministic or push parsers.
+different language because it is clearer, because it will always choose the
+correct skeleton for the specified language combined with other parser
+features, such as GLR, and because it simplifies the rules for computing output
+file names.
 
 If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
 file in the Bison installation directory.
@@ -7167,16 +7177,18 @@ behaves improperly (@pxref{Tracing, , Tracing Your 
Parser}).
 As documented elsewhere (@pxref{Algorithm, ,The Bison Parser Algorithm})
 Bison parsers are @dfn{shift/reduce automata}.  In some cases (much more
 frequent than one would hope), looking at this automaton is required to
-tune or simply fix a parser.  Bison provides two different
-representation of it, either textually or graphically (as a DOT file).
+tune or simply fix a parser.
+Bison provides three different representations of it: textually, graphically
+(as a DOT file), or in XML.
 
 The textual file is generated when the options @option{--report} or
 @option{--verbose} are specified, see @xref{Invocation, , Invoking
-Bison}.  Its name is made by removing @samp{.tab.c} or @samp{.c} from
-the parser output file name, and adding @samp{.output} instead.
-Therefore, if the input file is @file{foo.y}, then the parser file is
-called @file{foo.tab.c} by default.  As a consequence, the verbose
-output file is called @file{foo.output}.
+Bison}.
+Its name is usually made by removing @samp{.y} from the grammar file name and
+adding @samp{.output} instead.
+Therefore, if the input file is @file{foo.y}, then the verbose output file is
+called @file{foo.output}.
address@hidden Files}, for further details on how the file is named.
 
 The following grammar file, @file{calc.y}, will be used in the sequel:
 
@@ -7679,47 +7691,207 @@ print_token_value (FILE *file, int type, YYSTYPE value)
 The usual way to invoke Bison is as follows:
 
 @example
-bison @var{infile}
address@hidden example
-
-Here @var{infile} is the grammar file name, which usually ends in
address@hidden  The parser file's name is made by replacing the @samp{.y}
-with @samp{.tab.c} and removing any leading directory.  Thus, the
address@hidden foo.y} file name yields
address@hidden, and the @samp{bison hack/foo.y} file name yields
address@hidden  It's also possible, in case you are writing
-C++ code instead of C in your grammar file, to name it @file{foo.ypp}
-or @file{foo.y++}.  Then, the output files will take an extension like
-the given one as input (respectively @file{foo.tab.cpp} and
address@hidden).
-This feature takes effect with all options that manipulate file names like
address@hidden or @samp{-d}.
-
-For example :
-
address@hidden
-bison -d @var{infile.yxx}
address@hidden example
address@hidden
-will produce @file{infile.tab.cxx} and @file{infile.tab.hxx}, and
-
address@hidden
-bison -d -o @var{output.c++} @var{infile.y}
+bison address@hidden @var{infile}
 @end example
address@hidden
-will produce @file{output.c++} and @file{outfile.h++}.
 
address@hidden Here @var{infile} is the grammar file name, which usually ends in
address@hidden
+The main focus of this section is how Bison's behavior is affected by
address@hidden
 For compatibility with @acronym{POSIX}, the standard Bison
 distribution also contains a shell script called @command{yacc} that
 invokes Bison with the @option{-y} option.
 
 @menu
+* Output Files::      How Bison computes the names of its output files.
 * Bison Options::     All the options described in detail,
                         in alphabetical order by short options.
 * Option Cross Key::  Alphabetical list of long options.
 * Yacc Library::      Yacc-compatible @code{yylex} and @code{main}.
 @end menu
 
address@hidden Output Files
address@hidden Output Files
address@hidden file names
address@hidden output file names
+
address@hidden %language
+We encourage you to always declare the programming language in which you wish
+Bison to encode the output parser even if you desire the default output
+language, C.
+To do so, you must use the command-line option @code{-L} or @code{--language}
+or the grammar file directive @code{%language}.
+For example, the following directive declares the output language as C:
+
address@hidden
+%language "C"
address@hidden smallexample
+
address@hidden Declaring the output language currently has two effects.
+First, Bison automatically selects the appropriate code skeleton for the
+combination of the specified language and other parser options, such as GLR.
+Second, it activates simplified rules for computing the output file names, many
+of which are based on the output language.
+For each file name or file name part in these simplified rules, the following
+table shows the default value that Bison computes as well as any command-line
+options or grammar directives that can override the default:
+
address@hidden
address@hidden File Prefix
+
address@hidden
address@hidden Purpose: Prefix of most output file names.
address@hidden Default: Grammar file name minus any leading directories and any
+extension.
+
address@hidden address@hidden/bar/baz.y}}      {Default}
address@hidden   Grammar File           @tab Default
address@hidden       @code{foo.y}           @tab @code{foo}
address@hidden       @code{foo.bison}       @tab @code{foo}
address@hidden       @code{foo.}            @tab @code{foo}
address@hidden       @code{foo}             @tab @code{foo}
address@hidden       @code{foo.bar.y}       @tab @code{foo.bar}
address@hidden       @code{foo.bar.}        @tab @code{foo.bar}
address@hidden       @code{foo/bar/baz.y}   @tab @code{baz}
address@hidden multitable
+
address@hidden Yacc Default: If the output language is C and you request Yacc
+compatibility (by @code{-y}, @code{--yacc}, or @code{%yacc}), then the default
+is instead simply @code{y}.
+
address@hidden Options: @code{-b @var{PREFIX}}, @address@hidden
address@hidden Directives: @code{%file-prefix "@var{PREFIX}"}
address@hidden itemize
+
address@hidden Parser Source Code File
+
address@hidden
address@hidden Purpose: Main parser implementation.
address@hidden Default: File prefix plus a language-specific extension.
+
address@hidden {Language}    {File Prefix}      {Default}
address@hidden   Language @tab File Prefix   @tab Default
address@hidden       C        @tab @code{foo}    @tab @code{foo.c}
address@hidden       C++      @tab @code{foo}    @tab @code{foo.cc}
address@hidden       Java     @tab @code{foo}    @tab @code{foo.java}
address@hidden multitable
+
address@hidden Yacc Default: If the output language is C and you request Yacc
+compatibility (by @code{-y}, @code{--yacc}, or @code{%yacc}), then the default
+is instead the file prefix plus @code{.tab.c}.
+
address@hidden Options: @code{-o @var{FILE}}, @address@hidden
address@hidden Directives: @code{%output "@var{FILE}"}
address@hidden itemize
+
address@hidden Parser Header File
+
address@hidden
address@hidden Purpose: Main parser declarations, if supported by the specified 
language
+and if you request it (by @code{-d}, @code{--defines}, or @code{%defines}).
address@hidden Default: File prefix plus a language-specific extension.
+
address@hidden {Language}    {File Prefix}      {not supported}
address@hidden   Language @tab File Prefix   @tab Default
address@hidden       C        @tab @code{foo}    @tab @code{foo.h}
address@hidden       C++      @tab @code{foo}    @tab @code{foo.hh}
address@hidden       Java     @tab @code{foo}    @tab not supported
address@hidden multitable
+
address@hidden Yacc Default: If the output language is C and you request Yacc
+compatibility (by @code{-y}, @code{--yacc}, or @code{%yacc}), then the default
+is instead the file prefix plus @code{.tab.h}.
+
address@hidden Options: @address@hidden
address@hidden Directives: @code{%defines "@var{FILE}"}
address@hidden itemize
+
address@hidden Auxiliary Code Files
+
+For some output languages, Bison generates auxiliary code files whose base
+names are static but that will be placed in any directory you specify as part
+of the file prefix.
+For example, one of the auxiliary header files Bison always generates for C++
+is @code{location.hh}.
+If the file prefix is @code{foo/bar}, then the file name is
address@hidden/location.hh}.
address@hidden Languages}, for a description of the various auxiliary files.
+
address@hidden Automaton Files
+
+When requested, Bison can describe the generated LALR(1) automaton in several
+formats, such as XML.
+By default, the name of the file is the file prefix plus the appropriate
+extension for that format.
+The names of these files do not depend on the selected output language, so we
+discuss them further in the following sections.
address@hidden enumerate
+
+When the output language is not declared with @code{-L}, @code{--language}, or
address@hidden, the rules for computing the output file names become more
+complicated.
+This behavior is for backward compatibility.
+The differences are as follows:
+
address@hidden
address@hidden File prefix from parser source code file.
+
+If you explicitly specify a parser source code file name, then Bison (1)
+extracts the file prefix from it instead of from the grammar file name and (2)
+ignores any file prefix that you explicitly specify.
+
address@hidden Tab.
+
+If the file prefix is extracted from the parser source code file name, then
+Bison removes any trailing @code{_tab} or @code{.tab} from the resulting file
+prefix while computing the automaton file names.
+If not, Bison appends a @code{.tab} to the file prefix while computing the
+parser source code and header file names.
+This is problematic for languages like Java.
+
address@hidden Parser source code file extension from grammar file extension.
+
+The default parser source code file extension is constructed by replacing
address@hidden with @code{c} and @code{Y} with @code{C} in the grammar file
+extension.
+However, if there is no grammar file extension or you request Yacc
+compatibility, then the default extension is just @code{.c}.
+
address@hidden Parser header file extension from source code file extension.
+
+The default parser header file extension is constructed by replacing @code{c}
+with @code{h} and @code{C} with @code{H} in the parser source code file
+extension.
address@hidden enumerate
+
+We dislike the old rules because they increase complexity, thus they are less
+intuitive, their tab concept is archaic, and they do not extend nicely to
+languages besides C and C++.
+Moreover, they lead to unexpected file names in some cases even for C and C++.
+For example, if you name your grammar file @code{parser.yacc}, the old rules
+choose the default names @code{parser.tab.hacc} and @code{parser.tab.cacc}, but
+the new rules choose the default names @code{parser.h} and @code{parser.c} for
+C and @code{parser.hh} and @code{parser.cc} for C++.
+If you name your grammar file @code{parser.bison}, the old rules name both
+files @code{parser.tab.bison} by default, but the new rules again choose
address@hidden and @code{parser.c} for C and @code{parser.hh} and
address@hidden for C++.
+If you find that you really prefer the names chosen by the old rules but you
+still wish to use @code{%language}, you can always request whatever file names
+you want explicitly with, for example, @code{--output} and @code{--defines}.
+
+If you are a developer working on an experimental Bison skeleton, you should be
+aware that the Bison front-end does not dictate the names of output files.
+Thus, until @code{%language} support is implemented for your skeleton, you can
+declare @code{%language} with perhaps a bogus argument to get the newer output
+file naming rules, you can use @code{%skeleton} to select your skeleton, and
+your skeleton can still choose file names with extensions that are appropriate
+for its output language.
+However, your skeleton should choose names that follow the conventions
+documented in original table above.
+Also, once @code{%language} support has been implemented for your skeleton, any
+new file name extensions should be documented in that table.
+
 @node Bison Options
 @section Bison Options
 
@@ -7760,6 +7932,7 @@ other minor ways.  Most importantly, imitate Yacc's output
 file name conventions, so that the parser output file is called
 @file{y.tab.c}, and the other outputs are called @file{y.output} and
 @file{y.tab.h}.
address@hidden Files}, for further details.
 Also, if generating an @acronym{LALR}(1) parser in C, generate @code{#define}
 statements in addition to an @code{enum} to associate token numbers with token
 names.
@@ -7831,9 +8004,8 @@ already defined, so that the debugging facilities are 
compiled.
 @item -L @var{language}
 @itemx address@hidden
 Specify the programming language for the generated parser, as if
address@hidden was specified (@pxref{Decl Summary, , Bison Declaration
-Summary}).  Currently supported languages include C, C++, and Java.
address@hidden is case-insensitive.
address@hidden was specified.
address@hidden Summary, , Bison Declaration Summary}, for further details.
 
 @item --locations
 Pretend that @code{%locations} was specified.  @xref{Decl Summary}.
@@ -7858,8 +8030,10 @@ Specify the skeleton to use, similar to @code{%skeleton}
 
 You probably don't need this option unless you are developing Bison.
 You should use @option{--language} if you want to specify the skeleton for a
-different language, because it is clearer and because it will always
-choose the correct skeleton for non-deterministic or push parsers.
+different language because it is clearer, because it will always choose the
+correct skeleton for the specified language combined with other parser
+features, such as GLR, and because it simplifies the rules for computing output
+file names.
 
 If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
 file in the Bison installation directory.
@@ -7921,10 +8095,9 @@ parser.  @xref{Decl Summary}.
 
 @item -o @var{file}
 @itemx address@hidden
-Specify the @var{file} for the parser file.
-
-The other output files' names are constructed from @var{file} as
-described under the @samp{-v} and @samp{-d} options.
+Pretend that @code{%output} was specified, i.e., specify the name of
+the parser file.
address@hidden Summary}.
 
 @item address@hidden
 @itemx address@hidden
@@ -7932,15 +8105,17 @@ Output a graphical representation of the 
@acronym{LALR}(1) grammar
 automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz}
 @uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format.
 @address@hidden is optional.
-If omitted and the grammar file is @file{foo.y}, the output file will be
address@hidden
+If @var{file} is omitted and the grammar file is @file{foo.y}, the output file
+is usually @file{foo.dot}.
address@hidden Files}, for further details on how the file name is chosen.
 
 @item address@hidden
 @itemx address@hidden
 Output an XML report of the @acronym{LALR}(1) automaton computed by Bison.
 @address@hidden is optional.
-If omitted and the grammar file is @file{foo.y}, the output file will be
address@hidden
+If @var{file} is omitted and the grammar file is @file{foo.y}, the output file
+is usually @file{foo.xml}.
address@hidden Files}, for further details on how the file name is chosen.
 (The current XML schema is experimental and may evolve.
 More user feedback will help to stabilize it.)
 @end table
@@ -9542,11 +9717,11 @@ Define a variable to adjust Bison's behavior.
 @end deffn
 
 @deffn {Directive} %defines
-Bison declaration to create a header file meant for the scanner.
+Bison declaration to create a header file.
 @xref{Decl Summary}.
 @end deffn
 
address@hidden {Directive} %defines @var{defines-file}
address@hidden {Directive} %defines "@var{defines-file}"
 Same as above, but save in the file @var{defines-file}.
 @xref{Decl Summary}.
 @end deffn
diff --git a/src/files.c b/src/files.c
index 07f761b..be10c36 100644
--- a/src/files.c
+++ b/src/files.c
@@ -21,6 +21,7 @@
 #include <config.h>
 #include "system.h"
 
+#include <c-strcase.h>
 #include <error.h>
 #include <dirname.h>
 #include <get-errno.h>
@@ -41,13 +42,14 @@
    for instance, will not be honored.  */
 
 char const *spec_outfile = NULL;       /* for -o. */
+char const *spec_defines_file = NULL;  /* for --defines. */
 char const *spec_file_prefix = NULL;   /* for -b. */
 char const *spec_name_prefix = NULL;   /* for -p. */
 char *spec_verbose_file = NULL;  /* for --verbose. */
 char *spec_graph_file = NULL;    /* for -g. */
 char *spec_xml_file = NULL;      /* for -x. */
-char *spec_defines_file = NULL;  /* for --defines. */
-char *parser_file_name;
+char *parser_file_name = NULL;
+char *defines_file_name = NULL;
 
 /* All computed output file names.  */
 static char **file_names = NULL;
@@ -149,20 +151,12 @@ tr (char *s, char from, char to)
 static void
 compute_exts_from_gf (const char *ext)
 {
-  if (strcmp (ext, ".y") == 0)
-    {
-      src_extension = xstrdup (language->src_extension);
-      header_extension = xstrdup (language->header_extension);
-    }
-  else
-    {
-      src_extension = xstrdup (ext);
-      header_extension = xstrdup (ext);
-      tr (src_extension, 'y', 'c');
-      tr (src_extension, 'Y', 'C');
-      tr (header_extension, 'y', 'h');
-      tr (header_extension, 'Y', 'H');
-    }
+  src_extension = xstrdup (ext);
+  header_extension = xstrdup (ext);
+  tr (src_extension, 'y', 'c');
+  tr (src_extension, 'Y', 'C');
+  tr (header_extension, 'y', 'h');
+  tr (header_extension, 'Y', 'H');
 }
 
 /* Compute extensions from the given c source file extension.  */
@@ -232,7 +226,38 @@ file_name_split (const char *file_name,
 
 
 static void
-compute_file_name_parts (void)
+compute_file_name_parts_new (char const **extp)
+{
+  char const *base, *tab, *ext;
+  file_name_split (grammar_file, &base, &tab, &ext);
+  if (extp)
+    *extp = ext;
+  if (spec_file_prefix)
+    {
+      /* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'.  */
+      dir_prefix =
+        xstrndup (spec_file_prefix,
+                  last_component (spec_file_prefix) - spec_file_prefix);
+      all_but_tab_ext = xstrdup (spec_file_prefix);
+    }
+  else if (yacc_flag && 0 == c_strcasecmp (language->language, "c"))
+    {
+      /* If --yacc, then the output is `y.tab.c'.  */
+      dir_prefix = xstrdup ("");
+      all_but_tab_ext = xstrdup ("y");
+    }
+  else
+    {
+      /* Otherwise, ALL_BUT_TAB_EXT is computed from the input
+         grammar: `foo/bar.yy' => `bar'.  */
+      dir_prefix = xstrdup ("");
+      all_but_tab_ext =
+        xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
+    }
+}
+
+static void
+compute_file_name_parts_old (void)
 {
   const char *base, *tab, *ext;
 
@@ -262,36 +287,8 @@ compute_file_name_parts (void)
     }
   else
     {
-      file_name_split (grammar_file, &base, &tab, &ext);
-
-      if (spec_file_prefix)
-       {
-         /* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'.  */
-         dir_prefix =
-            xstrndup (spec_file_prefix,
-                      last_component (spec_file_prefix) - spec_file_prefix);
-         all_but_tab_ext = xstrdup (spec_file_prefix);
-       }
-      else if (yacc_flag)
-       {
-         /* If --yacc, then the output is `y.tab.c'.  */
-         dir_prefix = xstrdup ("");
-         all_but_tab_ext = xstrdup ("y");
-       }
-      else
-       {
-         /* Otherwise, ALL_BUT_TAB_EXT is computed from the input
-            grammar: `foo/bar.yy' => `bar'.  */
-         dir_prefix = xstrdup ("");
-         all_but_tab_ext =
-           xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
-       }
-
-      if (language->add_tab)
-        all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
-      else
-        all_but_ext = xstrdup (all_but_tab_ext);
-
+      compute_file_name_parts_new (&ext);
+      all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
       /* Compute the extensions from the grammar file name.  */
       if (ext && !yacc_flag)
        compute_exts_from_gf (ext);
@@ -300,28 +297,49 @@ compute_file_name_parts (void)
 
 
 /* Compute the output file names.  Warn if we detect conflicting
-   outputs to the same file.  */
+   outputs to the same file.  See the section Output Files in the
+   Bison manual for an explanation of output file naming.  */
 
 void
 compute_output_file_names (void)
 {
-  compute_file_name_parts ();
-
-  /* If not yet done. */
-  if (!src_extension)
-    src_extension = xstrdup (".c");
-  if (!header_extension)
-    header_extension = xstrdup (".h");
-
-  parser_file_name =
-    (spec_outfile
-     ? xstrdup (spec_outfile)
-     : concat2 (all_but_ext, src_extension));
-
-  if (defines_flag)
+  if (language_prio == default_prio)
+    {
+      /* Old logic for computing output file names.  Used when %language or
+       * equivalent is not specified.  */
+      compute_file_name_parts_old ();
+
+      /* If not yet done. */
+      if (!src_extension)
+        src_extension = xstrdup (".c");
+      if (!header_extension)
+        header_extension = xstrdup (".h");
+
+      parser_file_name =
+        (spec_outfile
+         ? xstrdup (spec_outfile)
+         : concat2 (all_but_ext, src_extension));
+
+      if (defines_flag)
+        {
+          if (spec_defines_file)
+            defines_file_name = xstrdup (spec_defines_file);
+          else
+            defines_file_name = concat2 (all_but_ext, header_extension);
+        }
+
+      free (src_extension);
+      free (header_extension);
+    }
+  else
     {
-      if (! spec_defines_file)
-       spec_defines_file = concat2 (all_but_ext, header_extension);
+      /* New logic for computing output file names.  Used when %language or
+       * equivalent is specified.  */
+      compute_file_name_parts_new (NULL);
+      if (yacc_flag && 0 == c_strcasecmp (language->language, "c"))
+        all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+      else
+        all_but_ext = xstrdup (all_but_tab_ext);
     }
 
   if (graph_flag)
@@ -346,8 +364,6 @@ compute_output_file_names (void)
     }
 
   free (all_but_tab_ext);
-  free (src_extension);
-  free (header_extension);
 }
 
 void
@@ -372,8 +388,8 @@ output_file_names_free (void)
   free (spec_verbose_file);
   free (spec_graph_file);
   free (spec_xml_file);
-  free (spec_defines_file);
   free (parser_file_name);
+  free (defines_file_name);
   free (dir_prefix);
   {
     int i;
diff --git a/src/files.h b/src/files.h
index 3a72193..4e08fd6 100644
--- a/src/files.h
+++ b/src/files.h
@@ -1,6 +1,6 @@
 /* File names and variables for bison,
 
-   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2006, 2007 Free Software
+   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2006, 2007, 2008 Free Software
    Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -29,6 +29,12 @@ extern char const *spec_outfile;
 /* File name for the parser (i.e., the one above, or its default.) */
 extern char *parser_file_name;
 
+/* File name specified with --defines.  */
+extern char const *spec_defines_file;
+
+/* File name for the header (i.e., the one above, or its default.) */
+extern char *defines_file_name;
+
 /* Symbol prefix specified with -p, or 0 if no -p.  */
 extern const char *spec_name_prefix;
 
@@ -44,9 +50,6 @@ extern char *spec_graph_file;
 /* File name specified for the xml output.  */
 extern char *spec_xml_file;
 
-/* File name specified with --defines.  */
-extern char *spec_defines_file;
-
 /* Directory prefix of output file names.  */
 extern char *dir_prefix;
 
diff --git a/src/getargs.c b/src/getargs.c
index 8eecb5f..e4880cf 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -64,15 +64,15 @@ int trace_flag = trace_none;
 int warnings_flag = warnings_none;
 
 static struct bison_language const valid_languages[] = {
-  { "c", "c-skel.m4", ".c", ".h", true },
-  { "c++", "c++-skel.m4", ".cc", ".hh", true },
-  { "java", "java-skel.m4", ".java", ".java", false },
-  { "", "", "", "", false }
+  { "c", "c-skel.m4" },
+  { "c++", "c++-skel.m4" },
+  { "java", "java-skel.m4" },
+  { "", "" }
 };
 
-static int skeleton_prio = 2;
+static int skeleton_prio = default_prio;
 const char *skeleton = NULL;
-static int language_prio = 2;
+int language_prio = default_prio;
 struct bison_language const *language = &valid_languages[0];
 const char *include = NULL;
 
@@ -511,7 +511,7 @@ getargs (int argc, char *argv[])
        /* Here, the -d and --defines options are differentiated.  */
        defines_flag = true;
        if (optarg)
-         spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+         spec_defines_file = AS_FILE_NAME (optarg);
        break;
 
       case 'I':
@@ -519,11 +519,11 @@ getargs (int argc, char *argv[])
        break;
 
       case 'L':
-       language_argmatch (optarg, 0, NULL);
+       language_argmatch (optarg, command_line_prio, NULL);
        break;
 
       case 'S':
-       skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
+       skeleton_arg (AS_FILE_NAME (optarg), command_line_prio, NULL);
        break;
 
       case 'T':
diff --git a/src/getargs.h b/src/getargs.h
index 8449626..e3c479f 100644
--- a/src/getargs.h
+++ b/src/getargs.h
@@ -1,7 +1,7 @@
 /* Parse command line arguments for bison.
 
    Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -63,11 +63,10 @@ struct bison_language
 {
   char language[sizeof "Java"];
   char skeleton[sizeof "java-skel.m4"];
-  char src_extension[sizeof ".java"];
-  char header_extension[sizeof ".java"];
-  bool add_tab;
 };
 
+enum { command_line_prio, grammar_prio, default_prio };
+extern int language_prio;
 extern struct bison_language const *language;
 
 /*-----------.
diff --git a/src/output.c b/src/output.c
index 585b90e..209e524 100644
--- a/src/output.c
+++ b/src/output.c
@@ -622,11 +622,12 @@ prepare (void)
 #define DEFINE(Name) MUSCLE_INSERT_STRING (#Name, Name ? Name : "")
   DEFINE (dir_prefix);
   DEFINE (parser_file_name);
+  DEFINE (defines_file_name);
+  DEFINE (spec_outfile);
   DEFINE (spec_defines_file);
   DEFINE (spec_file_prefix);
   DEFINE (spec_graph_file);
   DEFINE (spec_name_prefix);
-  DEFINE (spec_outfile);
   DEFINE (spec_verbose_file);
 #undef DEFINE
 
diff --git a/src/parse-gram.y b/src/parse-gram.y
index fa74d8d..f7952b6 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -233,7 +233,7 @@ prologue_declaration:
 | "%defines" STRING
     {
       defines_flag = true;
-      spec_defines_file = xstrdup ($2);
+      spec_defines_file = $2;
     }
 | "%error-verbose"                 { error_verbose = true; }
 | "%expect" INT                    { expected_sr_conflicts = $2; }
@@ -254,7 +254,7 @@ prologue_declaration:
       muscle_code_grow ("initial_action", action.code, @2);
       code_scanner_last_string_free ();
     }
-| "%language" STRING           { language_argmatch ($2, 1, &@1); }
+| "%language" STRING           { language_argmatch ($2, grammar_prio, &@1); }
 | "%lex-param" "{...}"         { add_param ("lex_param", $2, @2); }
 | "%locations"                  { locations_flag = true; }
 | "%name-prefix" STRING         { spec_name_prefix = $2; }
@@ -300,7 +300,7 @@ prologue_declaration:
           skeleton_user = uniqstr_new (skeleton_build);
           free (skeleton_build);
         }
-      skeleton_arg (skeleton_user, 1, &@1);
+      skeleton_arg (skeleton_user, grammar_prio, &@1);
     }
 | "%token-table"                { token_table_flag = true; }
 | "%verbose"                    { report_flag |= report_states; }
diff --git a/tests/output.at b/tests/output.at
index 1e37347..e62b38e 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -22,14 +22,14 @@ AT_BANNER([[Output file names.]])
 #                 [ADDITIONAL-TESTS])
 # -----------------------------------------------------------------------------
 m4_define([AT_CHECK_OUTPUT],
-[AT_SETUP([[Output files: $2 $3 $5]])
+[AT_SETUP([[Output files: ]$2 $3 $5])
 for file in $1 $4; do
   case "$file" in
     */*) mkdir -p `echo "$file" | sed 's,/.*,,'`;;
   esac
 done
 AT_DATA([$1],
-[[$2
+[$2[
 %%
 foo: {};
 ]])
@@ -124,6 +124,66 @@ AT_CHECK_OUTPUT([gram_dir/foo.yy],
                [output_dir/foo.tab.cc output_dir/foo.tab.hh 
output_dir/foo.output output_dir/location.hh output_dir/stack.hh 
output_dir/position.hh])
 
 
+## ----------- ##
+## %language.  ##
+## ----------- ##
+
+m4_define([cpp_aux], [$1[location.hh ]$1[position.hh ]$1[stack.hh]])
+
+# Default.
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x]],
+                [[foo.c foo.h foo.output foo.dot foo.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC++ -dv -g -x]],
+                [[foo.cc foo.hh foo.output foo.dot foo.xml ]cpp_aux])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LJava -v -g -x]],
+                [[foo.java foo.output foo.dot foo.xml]])
+
+# Yacc Default.
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -y]],
+                [[y.tab.c y.tab.h y.output y.dot y.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC++ -dv -g -x -y]],
+                [[foo.cc foo.hh foo.output foo.dot foo.xml ]cpp_aux])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LJava -v -g -x -y]],
+                [[foo.java foo.output foo.dot foo.xml]])
+
+# Override file prefix.
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -bdir/b]],
+                [[dir/b.c dir/b.h dir/b.output dir/b.dot dir/b.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -bdir/b -y]],
+                [[dir/b.tab.c dir/b.tab.h dir/b.output dir/b.dot dir/b.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC++ -dv -g -x -bdir/b]],
+                [[dir/b.cc dir/b.hh dir/b.output dir/b.dot dir/b.xml 
]cpp_aux([[dir/]])])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LJava -v -g -x -bdir/b]],
+                [[dir/b.java dir/b.output dir/b.dot dir/b.xml]])
+
+# Override file prefix and parser source code file.
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -bdir/b -obar-c]],
+                [[bar-c dir/b.h dir/b.output dir/b.dot dir/b.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -bdir/b -obar-c -y]],
+                [[bar-c dir/b.tab.h dir/b.output dir/b.dot dir/b.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC++ -dv -g -x -bdir/b -obar.cpp]],
+                [[bar.cpp dir/b.hh dir/b.output dir/b.dot dir/b.xml 
]cpp_aux([[dir/]])])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LJava -v -g -x -bdir/b -obar.Java]],
+                [[bar.Java dir/b.output dir/b.dot dir/b.xml]])
+
+# Override parser source code file.
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -obar-c]],
+                [[bar-c foo.h foo.output foo.dot foo.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC -dv -g -x -obar-c -y]],
+                [[bar-c y.tab.h y.output y.dot y.xml]])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LC++ -dv -g -x -obar.cpp]],
+                [[bar.cpp foo.hh foo.output foo.dot foo.xml ]cpp_aux])
+AT_CHECK_OUTPUT([[foo.bison]],, [[-LJava -v -g -x -odir/bar.Java]],
+                [[dir/bar.Java foo.output foo.dot foo.xml]])
+
+# Other overrides.
+AT_CHECK_OUTPUT([[foo.bison]],,
+                [[-LC -basdf --defines=dir/bar.h -v --report-file=dir2/bar.txt 
--graph=dir3/bar.DOT --xml=dir4/bar.XML]],
+                [[asdf.c dir/bar.h dir2/bar.txt dir3/bar.DOT dir4/bar.XML]])
+
+m4_undef([cpp_aux])
+
+
 # AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,
 #                             [EXIT-STATUS])
 # ------------------------------------------------------------------
-- 
1.5.4.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]