From: Paul Eggert Date: Tue, 20 Sep 2005 23:06:10 +0000 (+0000) Subject: * data/yacc.c (YYSIZE_T): Reindent to make it clearer. This X-Git-Tag: v2.3b~637 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/552893661babb72c427f5fe21e5a47c6d916af74 * 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 and might be included. (Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the user must declare alloca. --- diff --git a/ChangeLog b/ChangeLog index 1aad1e13..232fede6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2005-09-20 Paul Eggert + * 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 and 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 stable releses. diff --git a/data/yacc.c b/data/yacc.c index b4885605..bc98400a 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -219,18 +219,17 @@ typedef struct YYLTYPE /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])[ -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int +#ifndef YYSIZE_T +# if defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +# elif defined (size_t) +# define YYSIZE_T size_t +# elif ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) @@ -255,11 +254,20 @@ b4_syncline([@oline@], [@ofile@])[ # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined (_STDLIB_H) && (defined (__STDC__) || defined (__cplusplus)) # include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif @@ -286,14 +294,14 @@ extern "C" { # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ +# if (! defined (malloc) && ! defined (_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus))) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ +# if (! defined (free) && ! defined (_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus))) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif diff --git a/doc/bison.texinfo b/doc/bison.texinfo index 4cc32bea..eae08d97 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -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{}, +headers. On some non-@acronym{GNU} hosts, @code{}, @code{}, @code{}, and @code{} are included as needed to declare memory allocators and related types. @code{} 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{}. 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