]> git.saurik.com Git - bison.git/commitdiff
* data/c.m4 (b4_yy_symbol_print_generate):
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 21 May 2006 04:48:47 +0000 (04:48 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 21 May 2006 04:48:47 +0000 (04:48 +0000)
(b4_yy_symbol_print_generate): Use 'YYSTYPE const' rather than
'const YYSTYPE', and similarly for YYLTYPE.  This fixes one
of the bugs reported today by Derek M Jones in
<http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>.
* doc/bison.texinfo (Value Type): Document that YYSTYPE must be
defined to be a type name without parens or brackets.
(Location Type): Similarly for YYLTYPE.
* tests/regression.at (Trivial grammars): Put in a test for this
bug that will be caught by 'make maintainer-check' (though not,
alas, by 'make check' unless your compiler is picky).

ChangeLog
data/c.m4
doc/bison.texinfo
tests/regression.at

index f82892cc6784a18dfb6e80c77c582fc6aeaaeaf9..5e13d5a95e15a2599b08d4877d08b1e751a2d698 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-05-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * data/c.m4 (b4_yy_symbol_print_generate):
+       (b4_yy_symbol_print_generate): Use 'YYSTYPE const' rather than
+       'const YYSTYPE', and similarly for YYLTYPE.  This fixes one
+       of the bugs reported today by Derek M Jones in
+       <http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>.
+       * doc/bison.texinfo (Value Type): Document that YYSTYPE must be
+       defined to be a type name without parens or brackets.
+       (Location Type): Similarly for YYLTYPE.
+       * tests/regression.at (Trivial grammars): Put in a test for this
+       bug that will be caught by 'make maintainer-check' (though not,
+       alas, by 'make check' unless your compiler is picky).
+
 2006-05-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * NEWS: Version 2.2.
index c7c506368af8956cb7043629f098b9c2da4fce6d..f10e0901147c137b56d39504295de0bbc0684eca 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -483,8 +483,8 @@ m4_define_default([b4_yy_symbol_print_generate],
     [static void],
               [[FILE *yyoutput],                       [yyoutput]],
               [[int yytype],                           [yytype]],
-              [[const YYSTYPE * const yyvaluep],       [yyvaluep]][]dnl
-b4_locations_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl
+              [[YYSTYPE const * const yyvaluep],       [yyvaluep]][]dnl
+b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
 m4_ifset([b4_parse_param], [, b4_parse_param]))[
 {
   if (!yyvaluep)
@@ -515,8 +515,8 @@ b4_parse_param_use[]dnl
     [static void],
               [[FILE *yyoutput],                       [yyoutput]],
               [[int yytype],                           [yytype]],
-              [[const YYSTYPE * const yyvaluep],       [yyvaluep]][]dnl
-b4_locations_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl
+              [[YYSTYPE const * const yyvaluep],       [yyvaluep]][]dnl
+b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
 m4_ifset([b4_parse_param], [, b4_parse_param]))[
 {
   if (yytype < YYNTOKENS)
index 4b61b4012912f05e069bc6faacd2e67bfd1a4b80..5021e2e3eaa0c34f4efa08dbadd9c82e2c366375 100644 (file)
@@ -3067,6 +3067,8 @@ specify some other type, define @code{YYSTYPE} as a macro, like this:
 @end example
 
 @noindent
+@code{YYSTYPE}'s replacement list should be a type name
+that does not contain parentheses or square brackets.
 This macro definition must go in the prologue of the grammar file
 (@pxref{Grammar Outline, ,Outline of a Bison Grammar}).
 
@@ -3463,7 +3465,9 @@ actions to take when rules are matched.
 Defining a data type for locations is much simpler than for semantic values,
 since all tokens and groupings always use the same type.
 
-The type of locations is specified by defining a macro called @code{YYLTYPE}.
+You can specify the type of locations by defining a macro called
+@code{YYLTYPE}, just as you can specify the semantic value type by
+defining @code{YYSTYPE} (@pxref{Value Type}).
 When @code{YYLTYPE} is not defined, Bison uses a default structure type with
 four members:
 
index c5ceaf1473ef2ac0698583628b657ac3d541ee50..6a37f759a8e80a330e4ad5cabe88f79125251c34 100644 (file)
@@ -31,6 +31,7 @@ AT_DATA_GRAMMAR([input.y],
 [[%{
 void yyerror (char const *);
 int yylex (void);
+#define YYSTYPE int *
 %}
 
 %error-verbose
@@ -42,6 +43,7 @@ program: 'x';
 
 AT_CHECK([bison -o input.c input.y])
 AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o], [-DYYDEBUG -c input.c])
 
 AT_CLEANUP