* data/yacc.c (YYSIZE_T): Reindent to make it clearer. This

doesn't affect behavior.
(YYSTACK_ALLOC) [YYSTACK_USE_ALLOCA]: Improve support for
Solaris, AIX, MSC.
(_STDLIB_H): Renamed from YYINCLUDED_STDLIB_H.  All uses changed.
This works a bit better with glibc, if user code has already included
stdlib.h.
* doc/bison.texinfo (Bison Parser): Document that users can't
arbitrarily use malloc and free for other purposes.  Document
that <alloca.h> and <malloc.h> might be included.
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
user must declare alloca.
This commit is contained in:
Paul Eggert
2005-09-20 23:06:10 +00:00
parent a05b79dff9
commit 552893661b
3 changed files with 42 additions and 22 deletions

View File

@@ -1,5 +1,18 @@
2005-09-20 Paul Eggert <eggert@cs.ucla.edu> 2005-09-20 Paul Eggert <eggert@cs.ucla.edu>
* data/yacc.c (YYSIZE_T): Reindent to make it clearer. This
doesn't affect behavior.
(YYSTACK_ALLOC) [YYSTACK_USE_ALLOCA]: Improve support for
Solaris, AIX, MSC.
(_STDLIB_H): Renamed from YYINCLUDED_STDLIB_H. All uses changed.
This works a bit better with glibc, if user code has already included
stdlib.h.
* doc/bison.texinfo (Bison Parser): Document that users can't
arbitrarily use malloc and free for other purposes. Document
that <alloca.h> and <malloc.h> might be included.
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
user must declare alloca.
* HACKING (release): Forwarn the Translation Project about * HACKING (release): Forwarn the Translation Project about
stable releses. stable releses.

View File

@@ -219,18 +219,17 @@ typedef struct YYLTYPE
/* Line __line__ of yacc.c. */ /* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])[ b4_syncline([@oline@], [@ofile@])[
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) #ifndef YYSIZE_T
# define YYSIZE_T __SIZE_TYPE__ # if defined (__SIZE_TYPE__)
#endif # define YYSIZE_T __SIZE_TYPE__
#if ! defined (YYSIZE_T) && defined (size_t) # elif defined (size_t)
# define YYSIZE_T size_t # define YYSIZE_T size_t
#endif # elif ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t
# define YYSIZE_T size_t # else
#endif # define YYSIZE_T unsigned int
#if ! defined (YYSIZE_T) # endif
# define YYSIZE_T unsigned int
#endif #endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
@@ -255,11 +254,20 @@ b4_syncline([@oline@], [@ofile@])[
# if YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA
# ifdef __GNUC__ # ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca # define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else # else
# define YYSTACK_ALLOC alloca # define YYSTACK_ALLOC alloca
# if defined (__STDC__) || defined (__cplusplus) # if ! defined (_STDLIB_H) && (defined (__STDC__) || defined (__cplusplus))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYINCLUDED_STDLIB_H # ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif # endif
# endif # endif
# endif # endif
@@ -286,14 +294,14 @@ extern "C" {
# endif # endif
# ifndef YYMALLOC # ifndef YYMALLOC
# define YYMALLOC malloc # define YYMALLOC malloc
# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ # if (! defined (malloc) && ! defined (_STDLIB_H) \
&& (defined (__STDC__) || defined (__cplusplus))) && (defined (__STDC__) || defined (__cplusplus)))
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif # endif
# endif # endif
# ifndef YYFREE # ifndef YYFREE
# define YYFREE free # define YYFREE free
# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ # if (! defined (free) && ! defined (_STDLIB_H) \
&& (defined (__STDC__) || defined (__cplusplus))) && (defined (__STDC__) || defined (__cplusplus)))
void free (void *); /* INFRINGES ON USER NAME SPACE */ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif # endif

View File

@@ -1197,11 +1197,13 @@ function @code{yyerror} and the parser function @code{yyparse} itself.
This also includes numerous identifiers used for internal purposes. This also includes numerous identifiers used for internal purposes.
Therefore, you should avoid using C identifiers starting with @samp{yy} Therefore, you should avoid using C identifiers starting with @samp{yy}
or @samp{YY} in the Bison grammar file except for the ones defined in or @samp{YY} in the Bison grammar file except for the ones defined in
this manual. this manual. Also, you should avoid using the C identifiers
@samp{malloc} and @samp{free} for anything other than their usual
meanings.
In some cases the Bison parser file includes system headers, and in In some cases the Bison parser file includes system headers, and in
those cases your code should respect the identifiers reserved by those those cases your code should respect the identifiers reserved by those
headers. On some non-@acronym{GNU} hosts, @code{<alloca.h>}, headers. On some non-@acronym{GNU} hosts, @code{<alloca.h>}, @code{<malloc.h>},
@code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to @code{<stddef.h>}, and @code{<stdlib.h>} are included as needed to
declare memory allocators and related types. @code{<libintl.h>} is declare memory allocators and related types. @code{<libintl.h>} is
included if message translation is in use included if message translation is in use
@@ -8127,10 +8129,7 @@ the parser will use @code{malloc} to extend its stacks. If defined to
reserved for future Bison extensions. If not defined, reserved for future Bison extensions. If not defined,
@code{YYSTACK_USE_ALLOCA} defaults to 0. @code{YYSTACK_USE_ALLOCA} defaults to 0.
If you define @code{YYSTACK_USE_ALLOCA} to 1, it is your In the all-too-common case where your code may run on a host with a
responsibility to make sure that @code{alloca} is visible, e.g., by
using @acronym{GCC} or by including @code{<stdlib.h>}. Furthermore,
in the all-too-common case where your code may run on a host with a
limited stack and with unreliable stack-overflow checking, you should limited stack and with unreliable stack-overflow checking, you should
set @code{YYMAXDEPTH} to a value that cannot possibly result in set @code{YYMAXDEPTH} to a value that cannot possibly result in
unchecked stack overflow on any of your target hosts when unchecked stack overflow on any of your target hosts when