[PATCH 2/4] deprecate %defines in favor of %header

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
This is consistent with --defines being deprecated in favor of
--header.  The directive %defines is also too similar to %define.
And %header matches nicely with api.header.name.

* src/scan-gram.l (%defines): Deprecate to %header.
(%header): Scan it.
* src/parse-gram.y (PERCENT_DEFINES): Replace with...
(PERCENT_HEADER): this.
* data/skeletons/lalr1.java
* doc/bison.texi
* tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at,
* tests/input.at, tests/java.at, tests/local.at, tests/output.at,
* tests/synclines.at, tests/types.at:
Convert most tests to check %header instead of %defines.
---
 NEWS                      |  7 ++--
 data/skeletons/lalr1.java |  2 +-
 doc/bison.texi            | 74 ++++++++++++++++++++++----------------
 etc/bench.pl.in           |  2 +-
 src/parse-gram.y          | 35 ++++++++++--------
 src/scan-gram.l           |  5 +--
 tests/actions.at          | 12 +++----
 tests/c++.at              | 10 +++---
 tests/calc.at             | 75 ++++++++++++++++++++-------------------
 tests/conflicts.at        |  4 +--
 tests/input.at            |  6 +++-
 tests/java.at             | 22 +++++++++++-
 tests/local.at            |  6 ++--
 tests/output.at           | 54 ++++++++++++++++------------
 tests/synclines.at        |  4 +--
 tests/types.at            |  6 ++--
 16 files changed, 190 insertions(+), 134 deletions(-)

diff --git a/NEWS b/NEWS
index 3531e2fa..6cd331f6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,10 +6,11 @@ GNU Bison NEWS
 
 ** New features
 
-*** Option -H, --header
+*** Option -H, --header and directive %header
 
-  The option -H/--header replaces the option --defines (maintained for
-  backward compatibility).
+  The option -H/--header supersedes the option --defines, and the directive
+  %header supersedes %defines.  Both --defines and %defines are, of course,
+  maintained for backward compatibility.
 
 *** A C++ native GLR parser
 
diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java
index d749226f..72bef4c5 100644
--- a/data/skeletons/lalr1.java
+++ b/data/skeletons/lalr1.java
@@ -17,7 +17,7 @@
 
 m4_include(b4_skeletonsdir/[java.m4])
 
-b4_header_if([b4_complain([%defines does not make sense in Java])])
+b4_header_if([b4_complain([%header/%defines does not make sense in Java])])
 
 m4_define([b4_symbol_no_destructor_assert],
 [b4_symbol_if([$1], [has_destructor],
diff --git a/doc/bison.texi b/doc/bison.texi
index c73a28d2..7e4b9aa7 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -5794,6 +5794,22 @@ Define a variable to adjust Bison's behavior.  @xref{%define Summary}.
 @end deffn
 
 @deffn {Directive} %defines
+@deffnx {Directive} %defines @var{defines-file}
+Historical name for @code{%header}.  @xref{%header,,@code{%header}}.
+@end deffn
+
+@deffn {Directive} %destructor
+Specify how the parser should reclaim the memory associated to
+discarded symbols.  @xref{Destructor Decl}.
+@end deffn
+
+@deffn {Directive} %file-prefix "@var{prefix}"
+Specify a prefix to use for all Bison output file names.  The names
+are chosen as if the grammar file were named @file{@var{prefix}.y}.
+@end deffn
+
+@anchor{%header}
+@deffn {Directive} %header
 Write a parser header file containing definitions for the token kind names
 defined in the grammar as well as a few other declarations.  If the parser
 implementation file is named @file{@var{name}.c} then the parser header file
@@ -5835,7 +5851,7 @@ preprocessor guard: @samp{YY_@var{PREFIX}_@var{FILE}_INCLUDED}, where
 generated file name turned uppercase, with each series of non alphanumerical
 characters converted to a single underscore.
 
-For instance with @samp{%define api.prefix @{calc@}} and @samp{%defines
+For instance with @samp{%define api.prefix @{calc@}} and @samp{%header
 "lib/parse.h"}, the header will be guarded as follows.
 @example
 #ifndef YY_CALC_LIB_PARSE_H_INCLUDED
@@ -5843,20 +5859,12 @@ For instance with @samp{%define api.prefix @{calc@}} and @samp{%defines
 ...
 #endif /* ! YY_CALC_LIB_PARSE_H_INCLUDED */
 @end example
-@end deffn
-
-@deffn {Directive} %defines @var{defines-file}
-Same as above, but save in the file @file{@var{defines-file}}.
-@end deffn
 
-@deffn {Directive} %destructor
-Specify how the parser should reclaim the memory associated to
-discarded symbols.  @xref{Destructor Decl}.
+Introduced in Bison 3.8.
 @end deffn
 
-@deffn {Directive} %file-prefix "@var{prefix}"
-Specify a prefix to use for all Bison output file names.  The names
-are chosen as if the grammar file were named @file{@var{prefix}.y}.
+@deffn {Directive} %header @var{header-file}
+Same as above, but save in the file @file{@var{header-file}}.
 @end deffn
 
 @deffn {Directive} %language "@var{language}"
@@ -6153,7 +6161,7 @@ types are generated. @xref{Exposing the Location Classes}.
 @table @asis
 @item @code{none}
 If locations are enabled, generate the definition of the @code{position} and
-@code{location} classes in the header file if @code{%defines}, otherwise in
+@code{location} classes in the header file if @code{%header}, otherwise in
 the parser implementation.
 
 @item "@var{file}"
@@ -7256,8 +7264,8 @@ You call the function @code{yypstate_new} to create a new parser instance.
 This function is available if either the @samp{%define api.push-pull push}
 or @samp{%define api.push-pull both} declaration is used.  @xref{Push Decl}.
 
-@deftypefun {yypstate*} yypstate_new (@code{void})
 @anchor{yypstate_new}
+@deftypefun {yypstate*} yypstate_new (@code{void})
 Return a valid parser instance if there is memory available, 0 otherwise.
 In impure mode, it will also return 0 if a parser instance is currently
 allocated.
@@ -7269,8 +7277,8 @@ function is available if either the @samp{%define api.push-pull push} or
 @samp{%define api.push-pull both} declaration is used.
 @xref{Push Decl}.
 
-@deftypefun void yypstate_delete (@code{yypstate *}@var{yyps})
 @anchor{yypstate_delete}
+@deftypefun void yypstate_delete (@code{yypstate *}@var{yyps})
 Reclaim the memory associated with a parser instance.  After this call, you
 should no longer attempt to use the parser instance.
 @end deftypefun
@@ -7280,8 +7288,8 @@ You call the function @code{yypush_parse} to parse a single token.  This
 function is available if either the @samp{%define api.push-pull push} or
 @samp{%define api.push-pull both} declaration is used.  @xref{Push Decl}.
 
-@deftypefun int yypush_parse (@code{yypstate *}@var{yyps})
 @anchor{yypush_parse}
+@deftypefun int yypush_parse (@code{yypstate *}@var{yyps})
 The value returned by @code{yypush_parse} is the same as for @code{yyparse}
 with the following exception: it returns @code{YYPUSH_MORE} if more input is
 required to finish parsing the grammar.
@@ -7303,8 +7311,8 @@ You call the function @code{yypull_parse} to parse the rest of the input
 stream.  This function is available if the @samp{%define api.push-pull both}
 declaration is used.  @xref{Push Decl}.
 
-@deftypefun int yypull_parse (@code{yypstate *}@var{yyps})
 @anchor{yypull_parse}
+@deftypefun int yypull_parse (@code{yypstate *}@var{yyps})
 The value returned by @code{yypull_parse} is the same as for @code{yyparse}.
 
 The parser instance @code{yyps} may be reused for new parses.
@@ -11800,12 +11808,12 @@ Options controlling the output.
 @table @option
 @item -H [@var{file}]
 @itemx --header=[@var{file}]
-Pretend that @code{%defines} was specified, i.e., write an extra output file
+Pretend that @code{%header} was specified, i.e., write an extra output file
 containing definitions for the token kind names defined in the grammar, as
 well as a few other declarations.  @xref{Decl Summary}.
 
 @item --defines[=@var{file}]
-Historical name for option @option{--header}.
+Historical name for option @option{--header} before Bison 3.8.
 
 @item -d
 This is the same as @option{--header} except @option{-d} does not accept a
@@ -12211,7 +12219,7 @@ these two files (@file{@var{file}.hh} and @file{@var{file}.cc}) follow the
 same rules as with regular C parsers (@pxref{Invocation}).
 
 @item location.hh
-Generated when both @code{%defines} and @code{%locations} are enabled, this
+Generated when both @code{%header} and @code{%locations} are enabled, this
 file contains the definition of the classes @code{position} and
 @code{location}, used for location tracking.  It is not generated if
 @samp{%define api.location.file none} is specified, or if user defined
@@ -12608,7 +12616,7 @@ Report @var{p} on @var{o}, taking care of special cases such as: no
 @node Exposing the Location Classes
 @subsubsection Exposing the Location Classes
 
-When both @code{%defines} and @code{%locations} are enabled, Bison generates
+When both @code{%header} and @code{%locations} are enabled, Bison generates
 an additional file: @file{location.hh}.  If you don't use locations outside
 of the parser, you may avoid its creation with @samp{%define
 api.location.file none}.
@@ -12697,7 +12705,7 @@ definitions for @code{position} and @code{location}.  For instance, one
 parser @file{master/parser.yy} might use:
 
 @example
-%defines
+%header
 %locations
 %define api.namespace @{master::@}
 @end example
@@ -13273,7 +13281,7 @@ designed the grammar for.
 @example
 %skeleton "lalr1.cc" // -*- C++ -*-
 %require "@value{VERSION}"
-%defines
+%header
 @end example
 
 @noindent
@@ -13798,7 +13806,7 @@ GLR parsers are currently unsupported in Java.  Do not use the
 @code{glr-parser} directive.
 
 No header file can be generated for Java parsers.  Do not use the
-@code{%defines} directive or the @option{-d}/@option{-H}/@option{--header}
+@code{%header} directive or the @option{-d}/@option{-H}/@option{--header}
 options.
 
 @c FIXME: Possible code change.
@@ -15221,12 +15229,8 @@ Define a variable to adjust Bison's behavior.  @xref{%define Summary}.
 @end deffn
 
 @deffn {Directive} %defines
-Bison declaration to create a parser header file, which is usually
-meant for the scanner.  @xref{Decl Summary}.
-@end deffn
-
-@deffn {Directive} %defines @var{defines-file}
-Same as above, but save in the file @var{defines-file}.
+@deffnx {Directive} %defines @var{defines-file}
+Historical name for @code{%header}.
 @xref{Decl Summary}.
 @end deffn
 
@@ -15275,6 +15279,16 @@ Bison declaration to produce a GLR parser.  @xref{GLR
 Parsers}.
 @end deffn
 
+@deffn {Directive} %header
+Bison declaration to create a parser header file, which is usually
+meant for the scanner.  @xref{Decl Summary}.
+@end deffn
+
+@deffn {Directive} %header @var{header-file}
+Same as above, but save in the file @var{header-file}.
+@xref{Decl Summary}.
+@end deffn
+
 @deffn {Directive} %initial-action
 Run user code before parsing.  @xref{Initial Action Decl}.
 @end deffn
diff --git a/etc/bench.pl.in b/etc/bench.pl.in
index 96a92fb6..503ab7b9 100755
--- a/etc/bench.pl.in
+++ b/etc/bench.pl.in
@@ -581,7 +581,7 @@ sub generate_grammar_list ($$@)
     or die;
   print $out <<EOF;
 %language "C++"
-%defines
+%header
 %locations
 $directives
 
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 8c71fffe..73a2ccea 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -96,8 +96,8 @@
      string from the scanner (should be CODE). */
   static char const *translate_code_braceless (char *code, location loc);
 
-  /* Handle a %defines directive.  */
-  static void handle_defines (char const *value);
+  /* Handle a %header directive.  */
+  static void handle_header (char const *value);
 
   /* Handle a %error-verbose directive.  */
   static void handle_error_verbose (location const *loc, char const *directive);
@@ -153,7 +153,7 @@
 %define parse.error custom
 %define parse.lac full
 %define parse.trace
-%defines
+%header
 %expect 0
 %verbose
 
@@ -188,20 +188,19 @@
   PERCENT_CODE            "%code"
   PERCENT_DEFAULT_PREC    "%default-prec"
   PERCENT_DEFINE          "%define"
-  PERCENT_DEFINES         "%defines"
   PERCENT_ERROR_VERBOSE   "%error-verbose"
   PERCENT_EXPECT          "%expect"
   PERCENT_EXPECT_RR       "%expect-rr"
-  PERCENT_FLAG            "%<flag>"
   PERCENT_FILE_PREFIX     "%file-prefix"
+  PERCENT_FLAG            "%<flag>"
   PERCENT_GLR_PARSER      "%glr-parser"
+  PERCENT_HEADER          "%header"
   PERCENT_INITIAL_ACTION  "%initial-action"
   PERCENT_LANGUAGE        "%language"
   PERCENT_NAME_PREFIX     "%name-prefix"
   PERCENT_NO_DEFAULT_PREC "%no-default-prec"
   PERCENT_NO_LINES        "%no-lines"
-  PERCENT_NONDETERMINISTIC_PARSER
-                          "%nondeterministic-parser"
+  PERCENT_NONDETERMINISTIC_PARSER "%nondeterministic-parser"
   PERCENT_OUTPUT          "%output"
   PERCENT_PURE_PARSER     "%pure-parser"
   PERCENT_REQUIRE         "%require"
@@ -339,8 +338,7 @@ prologue_declaration:
       muscle_percent_define_insert ($2, @$, $3.kind, $3.chars,
                                     MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
     }
-| "%defines"                       { header_flag = true; }
-| "%defines" STRING                { handle_defines ($2); }
+| "%header" string.opt             { handle_header ($2); }
 | "%error-verbose"                 { handle_error_verbose (&@$, $1); }
 | "%expect" INT_LITERAL            { expected_sr_conflicts = $2; }
 | "%expect-rr" INT_LITERAL         { expected_rr_conflicts = $2; }
@@ -485,6 +483,12 @@ precedence_declarator:
 | "%precedence" { $$ = precedence_assoc; }
 ;
 
+%type <char*> string.opt;
+string.opt:
+  %empty  { $$ = NULL; }
+| STRING  { $$ = $1; }
+;
+
 tag.opt:
   %empty { $$ = NULL; }
 | TAG    { $$ = $1; }
@@ -947,13 +951,16 @@ add_param (param_type type, char *decl, location loc)
 
 
 static void
-handle_defines (char const *value)
+handle_header (char const *value)
 {
   header_flag = true;
-  char *file = unquote (value);
-  spec_header_file = xstrdup (file);
-  gram_scanner_last_string_free ();
-  unquote_free (file);
+  if (value)
+    {
+      char *file = unquote (value);
+      spec_header_file = xstrdup (file);
+      gram_scanner_last_string_free ();
+      unquote_free (file);
+    }
 }
 
 
diff --git a/src/scan-gram.l b/src/scan-gram.l
index e10d68e2..dea78e12 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -245,15 +245,16 @@ eqopt    ({sp}=)?
   "%debug"                          RETURN_PERCENT_FLAG ("parse.trace");
   "%default-prec"                   return BISON_DIRECTIVE (DEFAULT_PREC);
   "%define"                         return BISON_DIRECTIVE (DEFINE);
-  "%defines"                        return BISON_DIRECTIVE (DEFINES);
+  "%defines"                        DEPRECATED_DIRECTIVE ("%header");
   "%destructor"                     return BISON_DIRECTIVE (DESTRUCTOR);
   "%dprec"                          return BISON_DIRECTIVE (DPREC);
   "%empty"                          return BISON_DIRECTIVE (EMPTY);
   "%expect"                         return BISON_DIRECTIVE (EXPECT);
   "%expect-rr"                      return BISON_DIRECTIVE (EXPECT_RR);
   "%file-prefix"                    RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
-  "%initial-action"                 return BISON_DIRECTIVE (INITIAL_ACTION);
   "%glr-parser"                     return BISON_DIRECTIVE (GLR_PARSER);
+  "%header"                         return BISON_DIRECTIVE (HEADER);
+  "%initial-action"                 return BISON_DIRECTIVE (INITIAL_ACTION);
   "%language"                       return BISON_DIRECTIVE (LANGUAGE);
   "%left"                           return PERCENT_LEFT;
   "%lex-param"                      RETURN_PERCENT_PARAM (lex);
diff --git a/tests/actions.at b/tests/actions.at
index 9392da63..3978ae8f 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -1050,14 +1050,14 @@ AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
 AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
 AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
 
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "lalr1.cc"])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "lalr1.cc"], [ with union])
 
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"])
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"], [ with union])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr.cc"])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr.cc"], [ with union])
 
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr2.cc"])
-AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr2.cc"], [ with union])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr2.cc"])
+AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr2.cc"], [ with union])
 
 
 
diff --git a/tests/c++.at b/tests/c++.at
index a5fc7d93..2a3a8ca2 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -593,7 +593,7 @@ AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
 
 AT_DATA_GRAMMAR([[input.y]],
 [[%skeleton "lalr1.cc"
-%defines
+%header
 
 %debug
 %define parse.assert
@@ -727,7 +727,7 @@ AT_DATA([input.yy],
 [[%require "3.2"
 %skeleton "lalr1.cc"
 %locations
-%defines
+%header
 %debug
 %%
 exp: %empty;
@@ -964,7 +964,7 @@ AT_BISON_OPTION_PUSHDEFS([$1 %debug])
 
 AT_DATA_GRAMMAR([[input.yy]],
 [[$1
-%defines
+%header
 
 %code
 {
@@ -1453,7 +1453,7 @@ AT_BISON_OPTION_POPDEFS
 mkdir -p include/ast
 
 AT_TEST([x1],
-        [%defines
+        [%header
          %locations
          %define api.location.file "include/ast/loc.hh"
          %define api.location.include {<ast/loc.hh>}])
@@ -1468,7 +1468,7 @@ AT_CHECK([sed -ne '/INCLUDED/p;/\\file/{p;n;p;}' include/ast/loc.hh], [],
 ]])
 
 AT_TEST([x2],
-        [%defines
+        [%header
          %locations
          %code requires {#include <ast/loc.hh>}
          %define api.location.type {x1::location}])
diff --git a/tests/calc.at b/tests/calc.at
index b95b4845..c3557aa6 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -422,14 +422,14 @@ m4_define([AT_CALC_YYLEX(java)],
 
 # _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
 # -----------------------------------------------
-# Produce 'calc.y' and, if %defines was specified, 'calc-lex.c' or
+# Produce 'calc.y' and, if %header was specified, 'calc-lex.c' or
 # 'calc-lex.cc'.
 #
 # Don't call this macro directly, because it contains some occurrences
 # of '$1' etc. which will be interpreted by m4.  So you should call it
 # with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
 #
-# When %defines is not passed, generate a single self-contained file.
+# When %header is not passed, generate a single self-contained file.
 # Otherwise, generate three: calc.y with the parser, calc-lex.c with
 # the scanner, and calc-main.c with "main()".  This is in order to
 # stress the use of the generated parser header.  To avoid code
@@ -647,11 +647,11 @@ location_print (FILE *o, Span s)
 }
 ]])])[
 ]AT_YYERROR_DEFINE[
-]AT_DEFINES_IF([],
+]AT_HEADER_IF([],
 [AT_CALC_YYLEX
 AT_CALC_MAIN])])
 
-AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
+AT_HEADER_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
 [[#include "calc.]AT_LANG_HDR["
 
 ]AT_CALC_YYLEX])
@@ -752,7 +752,7 @@ exp:
 
 # AT_DATA_CALC_Y([BISON-OPTIONS])
 # -------------------------------
-# Produce 'calc.y' and, if %defines was specified, 'calc-lex.c' or
+# Produce 'calc.y' and, if %header was specified, 'calc-lex.c' or
 # 'calc-lex.cc'.
 m4_define([AT_DATA_CALC_Y],
 [_AT_DATA_CALC_Y($[1], $[2], $[3], [$1])
@@ -914,7 +914,7 @@ AT_SETUP([Calculator $1 $2])
 AT_BISON_OPTION_PUSHDEFS([$1])
 
 AT_DATA_CALC_Y([$1])
-AT_FULL_COMPILE(AT_JAVA_IF([[Calc]], [[calc]]), AT_DEFINES_IF([[lex], [main]], [[], []]), [$2], [-Wno-deprecated])
+AT_FULL_COMPILE(AT_JAVA_IF([[Calc]], [[calc]]), AT_HEADER_IF([[lex], [main]], [[], []]), [$2], [-Wno-deprecated])
 
 AT_YACC_IF(
   [# No direct calls to malloc/free.
@@ -926,7 +926,7 @@ AT_PUSH_IF([AT_JAVA_IF(
   AT_CHECK_JAVA_GREP([[Calc.java]],
                      [[.*public void push_parse_initialize ().*]])])])
 
-AT_CHECK_SPACES([AT_JAVA_IF([Calc], [calc]).AT_LANG_EXT AT_DEFINES_IF([AT_JAVA_IF([Calc], [calc]).AT_LANG_HDR])])
+AT_CHECK_SPACES([AT_JAVA_IF([Calc], [calc]).AT_LANG_EXT AT_HEADER_IF([AT_JAVA_IF([Calc], [calc]).AT_LANG_HDR])])
 
 # Test the precedences.
 # The Java traces do not show the clean up sequence at the end,
@@ -1081,7 +1081,7 @@ m4_define([AT_CHECK_CALC_LALR],
 
 AT_CHECK_CALC_LALR([%define parse.trace])
 
-AT_CHECK_CALC_LALR([%defines])
+AT_CHECK_CALC_LALR([%header])
 AT_CHECK_CALC_LALR([%debug %locations])
 AT_CHECK_CALC_LALR([%locations %define api.location.type {Span}])
 
@@ -1095,19 +1095,20 @@ AT_CHECK_CALC_LALR([%define api.pure full %locations])
 AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations])
 AT_CHECK_CALC_LALR([%define parse.error detailed %locations])
 
-AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %define api.prefix {calc} %verbose %yacc])
-AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error detailed %locations %header %define api.prefix {calc} %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error detailed %locations %header %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
 
 AT_CHECK_CALC_LALR([%debug])
-AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc])
 
-AT_CHECK_CALC_LALR([%define api.pure full %define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
+AT_CHECK_CALC_LALR([%define api.pure full %define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc])
 
-AT_CHECK_CALC_LALR([%define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_LALR([%define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
-AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
 
@@ -1128,7 +1129,7 @@ m4_define([AT_CHECK_CALC_GLR],
 
 AT_CHECK_CALC_GLR()
 
-AT_CHECK_CALC_GLR([%defines])
+AT_CHECK_CALC_GLR([%header])
 AT_CHECK_CALC_GLR([%locations])
 AT_CHECK_CALC_GLR([%locations %define api.location.type {Span}])
 AT_CHECK_CALC_GLR([%name-prefix "calc"])
@@ -1139,20 +1140,20 @@ AT_CHECK_CALC_GLR([%define parse.error verbose])
 AT_CHECK_CALC_GLR([%define api.pure %locations])
 AT_CHECK_CALC_GLR([%define parse.error verbose %locations])
 
-AT_CHECK_CALC_GLR([%define parse.error custom %locations %defines %name-prefix "calc" %verbose])
-AT_CHECK_CALC_GLR([%define parse.error detailed %locations %defines %name-prefix "calc" %verbose])
-AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR([%define parse.error custom %locations %header %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR([%define parse.error detailed %locations %header %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR([%define parse.error verbose %locations %header %name-prefix "calc" %verbose])
 
 AT_CHECK_CALC_GLR([%debug])
-AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose])
-AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
+AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %header %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
 
-AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose])
 
-AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
-AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
-AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
 
 # ---------------------- #
@@ -1162,7 +1163,7 @@ AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug
 AT_BANNER([[LALR(1) C++ Calculator.]])
 
 # First let's try using %skeleton
-AT_CHECK_CALC([%skeleton "lalr1.cc" %defines])
+AT_CHECK_CALC([%skeleton "lalr1.cc" %header])
 
 m4_define([AT_CHECK_CALC_LALR1_CC],
 [AT_CHECK_CALC([%language "C++" $1], [$2])])
@@ -1171,7 +1172,7 @@ AT_CHECK_CALC_LALR1_CC([])
 AT_CHECK_CALC_LALR1_CC([%locations])
 AT_CHECK_CALC_LALR1_CC([%locations], [$NO_EXCEPTIONS_CXXFLAGS])
 AT_CHECK_CALC_LALR1_CC([%locations %define api.location.type {Span}])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %name-prefix "calc" %verbose])
+AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %name-prefix "calc" %verbose])
 
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix {calc} %verbose])
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose])
@@ -1179,15 +1180,15 @@ AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-pref
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %verbose])
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
 
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
 AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file none])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file "my-location.hh"])
+AT_CHECK_CALC_LALR1_CC([%header %locations %define api.location.file none])
+AT_CHECK_CALC_LALR1_CC([%header %locations %define api.location.file "my-location.hh"])
 
-AT_CHECK_CALC_LALR1_CC([%no-lines %defines %locations %define api.location.file "my-location.hh"])
+AT_CHECK_CALC_LALR1_CC([%no-lines %header %locations %define api.location.file "my-location.hh"])
 
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.lac full %define parse.error verbose])
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.lac full %define parse.error detailed])
@@ -1212,7 +1213,7 @@ m4_define([AT_CHECK_CALC_GLR_CC],
 AT_CHECK_CALC_GLR_CC([])
 AT_CHECK_CALC_GLR_CC([%locations])
 AT_CHECK_CALC_GLR_CC([%locations %define api.location.type {Span}])
-AT_CHECK_CALC_GLR_CC([%defines %define parse.error verbose %name-prefix "calc" %verbose])
+AT_CHECK_CALC_GLR_CC([%header %define parse.error verbose %name-prefix "calc" %verbose])
 AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix {calc} %verbose])
 
 AT_CHECK_CALC_GLR_CC([%debug])
@@ -1220,10 +1221,10 @@ AT_CHECK_CALC_GLR_CC([%debug])
 AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose])
 AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose])
 
-AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
-AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
-AT_CHECK_CALC_GLR_CC([%no-lines %locations %defines %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
+AT_CHECK_CALC_GLR_CC([%no-lines %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
 
 
 # -------------------- #
diff --git a/tests/conflicts.at b/tests/conflicts.at
index de0a993e..9c1c5814 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -405,7 +405,7 @@ m4_pushdef([AT_CONSISTENT_ERRORS_CHECK], [
 
 AT_SETUP([[parse.error=verbose and consistent errors: ]$1])
 
-AT_BISON_OPTION_PUSHDEFS([$1 AT_CXX_IF([[%defines]], [[%define api.pure]])])
+AT_BISON_OPTION_PUSHDEFS([$1 AT_CXX_IF([[%header]], [[%define api.pure]])])
 
 AT_DATA_GRAMMAR([input.y],
 [AT_JAVA_IF([[
@@ -421,7 +421,7 @@ AT_DATA_GRAMMAR([input.y],
   #define USE(Var)
 }
 
-]AT_CXX_IF([[%defines]], [[%define api.pure]])])[
+]AT_CXX_IF([[%header]], [[%define api.pure]])])[
 
 ]AT_YACC_IF([[
 %code {
diff --git a/tests/input.at b/tests/input.at
index 9d9f6a28..46247c9e 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -2361,7 +2361,7 @@ m4_define([AT_CHECK_NAMESPACE_ERROR],
 [
 AT_DATA([[input.y]],
 [[%language "C++"
-%defines
+%header
 %define api.namespace {]$1[}
 %%
 start: %empty;
@@ -2908,6 +2908,7 @@ AT_DATA_GRAMMAR([[input.y]],
 %error-verbose
 %glr-parser
 %name-prefix "bar"
+%defines "header.h"
 %%
 exp : '0'
 ]])
@@ -2950,6 +2951,8 @@ fix-it:"input.y":{27:1-27:15}:""
 input.y:29.1-18: warning: duplicate directive: '%name-prefix "bar"' [-Wother]
 input.y:13.1-20: note: previous declaration
 fix-it:"input.y":{29:1-29:19}:""
+input.y:30.1-8: warning: deprecated directive: '%defines', use '%header' [-Wdeprecated]
+fix-it:"input.y":{30:1-30:9}:"%header"
 input.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
 ]])
 
@@ -2991,6 +2994,7 @@ AT_CHECK([sed -e '1,8d' input.y], [],
 %define api.pure
 %token-table
 %glr-parser
+%header "header.h"
 %%
 exp : '0'
 ]])
diff --git a/tests/java.at b/tests/java.at
index 57472446..4aca5b55 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -24,6 +24,21 @@ AT_BANNER([[Java Calculator.]])
 
 AT_SETUP([Java invalid directives])
 
+AT_DATA([[YYParser.y]], [
+%language "Java"
+%header
+%destructor { /* Nothing. */ } exp
+%%
+exp:
+])
+
+AT_BISON_CHECK([[-fcaret YYParser.y]], [1], [],
+[[YYParser.y: error: %header/%defines does not make sense in Java
+YYParser.y:4.13-30: error: %destructor does not make sense in Java
+    4 | %destructor { /* Nothing. */ } exp
+      |             ^~~~~~~~~~~~~~~~~~
+]])
+
 AT_DATA([[YYParser.y]], [
 %language "Java"
 %defines
@@ -33,10 +48,15 @@ exp:
 ])
 
 AT_BISON_CHECK([[-fcaret YYParser.y]], [1], [],
-[[YYParser.y: error: %defines does not make sense in Java
+[[YYParser.y:3.1-8: warning: deprecated directive: '%defines', use '%header' [-Wdeprecated]
+    3 | %defines
+      | ^~~~~~~~
+      | %header
+YYParser.y: error: %header/%defines does not make sense in Java
 YYParser.y:4.13-30: error: %destructor does not make sense in Java
     4 | %destructor { /* Nothing. */ } exp
       |             ^~~~~~~~~~~~~~~~~~
+YYParser.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
 ]])
 
 AT_CLEANUP
diff --git a/tests/local.at b/tests/local.at
index 83949f24..362b28cc 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -210,8 +210,8 @@ m4_if([$1$2], $[1]$[2], [],
        [m4_fatal([$0: invalid arguments: $@])])dnl
 m4_pushdef([AT_AUTOMOVE_IF],
 [m4_bmatch([$3], [%define api\.value\.automove], [$1], [$2])])
-m4_pushdef([AT_DEFINES_IF],
-[m4_bmatch([$3], [%defines], [$1], [$2])])
+m4_pushdef([AT_HEADER_IF],
+[m4_bmatch([$3], [%defines\|%header], [$1], [$2])])
 m4_pushdef([AT_DEBUG_IF],
            [m4_bmatch([$3], [%debug\|%define parse.trace], [$1], [$2])])
 m4_pushdef([AT_ERROR_CUSTOM_IF],
@@ -442,7 +442,7 @@ m4_popdef([AT_ERROR_VERBOSE_IF])
 m4_popdef([AT_ERROR_DETAILED_IF])
 m4_popdef([AT_ERROR_CUSTOM_IF])
 m4_popdef([AT_DEBUG_IF])
-m4_popdef([AT_DEFINES_IF])
+m4_popdef([AT_HEADER_IF])
 m4_popdef([AT_AUTOMOVE_IF])
 AT_LOC_POPDEF])dnl
 ])# AT_BISON_OPTION_POPDEFS
diff --git a/tests/output.at b/tests/output.at
index 2ef33354..a13aaf81 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -106,30 +106,30 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c],
                 [foo.c foo.dot foo.h foo.output])
 
 
-AT_CHECK_OUTPUT([foo.y], [%defines %verbose],      [],
+AT_CHECK_OUTPUT([foo.y], [%header %verbose],      [],
                 [foo.output foo.tab.c foo.tab.h])
-AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
+AT_CHECK_OUTPUT([foo.y], [%header %verbose %yacc],[],
                 [y.output y.tab.c y.tab.h])
 
-AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[],
+AT_CHECK_OUTPUT([foo.yy], [%header %verbose %yacc],[],
                 [y.output y.tab.c y.tab.h])
 
 # Exercise %output and %file-prefix including deprecated '='
-AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose],      [],
+AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %header %verbose],      [],
                 [bar.output bar.tab.c bar.tab.h])
-AT_CHECK_OUTPUT([foo.y], [%output "bar.c" %defines %verbose %yacc],[],
+AT_CHECK_OUTPUT([foo.y], [%output "bar.c" %header %verbose %yacc],[],
                 [bar.c bar.h bar.output])
 AT_CHECK_OUTPUT([foo.y],
-                [%file-prefix "baz" %output "bar.c" %defines %verbose %yacc],
+                [%file-prefix "baz" %output "bar.c" %header %verbose %yacc],
                 [],
                 [bar.c bar.h bar.output])
 
 
 # Check priorities of extension control.
-AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [],
+AT_CHECK_OUTPUT([foo.yy], [%header %verbose], [],
                 [foo.output foo.tab.cc foo.tab.hh])
 
-AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c],
+AT_CHECK_OUTPUT([foo.yy], [%header %verbose ], [-o foo.c],
                 [foo.c foo.h foo.output])
 
 AT_CHECK_OUTPUT([foo.yy], [],
@@ -137,10 +137,10 @@ AT_CHECK_OUTPUT([foo.yy], [],
                 [foo.c++ foo.hpp])
 
 AT_CHECK_OUTPUT([foo.yy], [],
-                [--defines=foo.hpp -o foo.c++],
+                [--header=foo.hpp -o foo.c++],
                 [foo.c++ foo.hpp])
 
-AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
+AT_CHECK_OUTPUT([foo.yy], [%header "foo.hpp"],
                 [-o foo.c++],
                 [foo.c++ foo.hpp])
 
@@ -162,6 +162,14 @@ AT_CHECK_OUTPUT([foo.y], [%define useless],
                 [foo.dot foo.output foo.xml],
                 [1])
 
+# %header was spelled %defines before.
+AT_CHECK_OUTPUT([foo.yy], [%defines],
+                [-o foo.c++],
+                [foo.c++ foo.h++])
+AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
+                [-o foo.c++],
+                [foo.c++ foo.hpp])
+
 
 ## ------------ ##
 ## C++ output.  ##
@@ -179,48 +187,48 @@ AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc"], [],
 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose], [],
                 [foo.output foo.tab.cc])
 
-AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
+AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %header %verbose], [],
                 [foo.output foo.tab.cc foo.tab.hh stack.hh])
 
 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose %locations], [],
                 [foo.output foo.tab.cc])
 
-AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations], [],
+AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %header %verbose %locations], [],
                 [foo.output foo.tab.cc foo.tab.hh location.hh position.hh stack.hh])
 
-AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
+AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %header %verbose], [],
                 [foo.output foo.tab.cc foo.tab.hh stack.hh],
                 [], [AT_CHECK_NO_SUBDIR_PART([foo.tab])])
 
-AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations],
+AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %header %verbose %locations],
                 [-o subdir/foo.cc],
                 [subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/position.hh subdir/stack.hh],
                 [], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
 
 AT_CHECK_OUTPUT([gram_dir/foo.yy],
-                [%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
+                [%skeleton "lalr1.cc" %header %verbose %file-prefix "output_dir/foo"],
                 [],
                 [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/stack.hh])
 
 AT_CHECK_OUTPUT([gram_dir/foo.yy],
-                [%skeleton "lalr1.cc" %defines %locations %verbose %file-prefix "output_dir/foo"],
+                [%skeleton "lalr1.cc" %header %locations %verbose %file-prefix "output_dir/foo"],
                 [],
                 [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh])
 
 # %require "3.2" => no position.hh not stack.hh.
 AT_CHECK_OUTPUT([foo.yy],
-                [%skeleton "lalr1.cc" %defines %locations %define api.location.file none %require "3.2"],
+                [%skeleton "lalr1.cc" %header %locations %define api.location.file none %require "3.2"],
                 [],
                 [foo.tab.cc foo.tab.hh])
 
 AT_CHECK_OUTPUT([foo.yy],
-                [%skeleton "lalr1.cc" %defines %locations %define api.location.file "foo.loc.hh" %require "3.2"],
+                [%skeleton "lalr1.cc" %header %locations %define api.location.file "foo.loc.hh" %require "3.2"],
                 [],
                 [foo.loc.hh foo.tab.cc foo.tab.hh])
 
 # Absolute paths.
 AT_CHECK_OUTPUT([foo.yy],
-                [%skeleton "lalr1.cc" %defines %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2"],
+                [%skeleton "lalr1.cc" %header %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2"],
                 [],
                 [foo.loc.hh foo.tab.cc foo.tab.hh])
 
@@ -255,12 +263,12 @@ AT_CHECK_CONFLICTING_OUTPUT([foo.y],
 ]])
 
 AT_CHECK_CONFLICTING_OUTPUT([foo.y],
-[%defines "foo.output"], [-v],
+[%header "foo.output"], [-v],
 [[foo.y: warning: conflicting outputs to file 'foo.output' [-Wother]
 ]])
 
 AT_CHECK_CONFLICTING_OUTPUT([foo.y],
-[%skeleton "lalr1.cc" %defines %locations], [--graph="location.hh"],
+[%skeleton "lalr1.cc" %header %locations], [--graph="location.hh"],
 [[foo.y: warning: conflicting outputs to file 'location.hh' [-Wother]
 ]])
 
@@ -757,7 +765,7 @@ AT_BISON_OPTION_POPDEFS
 mkdir -p out/include/ast
 
 AT_TEST([x1],
-        [%defines
+        [%header
          %locations
          %define api.location.file "include/ast/loc.hh"
          ])
@@ -788,7 +796,7 @@ AT_CHECK([[sed -ne 's/^#line [0-9][0-9]* "/#line "/p;/INCLUDED/p;/\\file/{p;n;p;
 ]])
 
 AT_TEST([x2],
-        [%defines
+        [%header
          %locations
          %code requires {#include "include/ast/loc.hh"}
          %define api.location.type {x1::location}])
diff --git a/tests/synclines.at b/tests/synclines.at
index b2cfac5c..e3401025 100644
--- a/tests/synclines.at
+++ b/tests/synclines.at
@@ -452,9 +452,9 @@ m4_popdef([AT_TEST])
 m4_pushdef([AT_TEST],
 [AT_SETUP([%no-lines: $1])
 
-AT_BISON_OPTION_PUSHDEFS([%skeleton "$1" %defines])
+AT_BISON_OPTION_PUSHDEFS([%skeleton "$1" %header])
 AT_DATA_GRAMMAR([input.y],
-[[%skeleton "$1" %defines
+[[%skeleton "$1" %header
 %{
 ]AT_YYERROR_DECLARE_EXTERN[
 ]AT_YYLEX_DECLARE_EXTERN[
diff --git a/tests/types.at b/tests/types.at
index 00f48a33..e35b0d40 100644
--- a/tests/types.at
+++ b/tests/types.at
@@ -123,7 +123,7 @@ AT_CLEANUP
 #         $6: RESULT,
 #         $7: REQUIREMENT)
 # --------------------------------------
-# Check with and without %defines, to avoid regressions.  It turns out
+# Check with and without %header, to avoid regressions.  It turns out
 # that in that case yacc.c calls the set-up of the %union twice,
 # because YYSTYPE is defined once in the header, and once in the
 # implementation file (eventually it'd be better to include the header
@@ -131,8 +131,8 @@ AT_CLEANUP
 # a second time doubled the side-effects and resulted in a double
 # definition of the union members.
 m4_pushdef([AT_TEST],
-[_AT_TEST([$1],          [$2], [$3], [$4], [$5], [$6], [$7])
- _AT_TEST([$1 %defines], [$2], [$3], [$4], [$5], [$6], [$7])
+[_AT_TEST([$1],         [$2], [$3], [$4], [$5], [$6], [$7])
+ _AT_TEST([$1 %header], [$2], [$3], [$4], [$5], [$6], [$7])
 ])
 
 m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc], [glr2.cc]],
-- 
2.28.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.