]> git.saurik.com Git - bison.git/commitdiff
* data/yacc.c (YYSIZE_T): Reindent to make it clearer. This
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Sep 2005 23:06:10 +0000 (23:06 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Sep 2005 23:06:10 +0000 (23:06 +0000)
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.

ChangeLog
data/yacc.c
doc/bison.texinfo

index 1aad1e137b3b70a4fd901ab3af6a3cac7bd03ff9..232fede61d8fb97375ca7ccd53fdbc98c6d80a42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 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
        stable releses.
 
index b4885605d1c1cb95378943891403d71437193bd6..bc98400a0ed769e64e52cf9b77b354c9a8acf54c 100644 (file)
@@ -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 <stddef.h> /* 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 <stddef.h> /* 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 <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
 #    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 */
-#     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
index 4cc32beaaf22dd83622bdcf39129d4aefc148071..eae08d978a961d6e4cf341f4324aff77e3080d29 100644 (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