* 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

@@ -1197,11 +1197,13 @@ function @code{yyerror} and the parser function @code{yyparse} itself.
This also includes numerous identifiers used for internal purposes.
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
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
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
declare memory allocators and related types. @code{<libintl.h>} is
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,
@code{YYSTACK_USE_ALLOCA} defaults to 0.
If you define @code{YYSTACK_USE_ALLOCA} to 1, it is your
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
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
set @code{YYMAXDEPTH} to a value that cannot possibly result in
unchecked stack overflow on any of your target hosts when