]> git.saurik.com Git - bison.git/commitdiff
* src/bison.simple (union yyalloc): Change member names
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 4 Dec 2001 14:06:06 +0000 (14:06 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 4 Dec 2001 14:06:06 +0000 (14:06 +0000)
to be the same as the stack names.
(YYPOINTER): Remove.
(yyparse): yyptr is now union yyalloc *, not char *.
(YYSTACK_RELOCATE): Likewise.  This avoids a GCC warning,
and may generate better code on some machines.

src/bison.simple

index 52b2d1ce2f697d04bf40ba1021d6db996738561c..e676360230faa715335b078e2649188597d08065 100644 (file)
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  short yys;
-  YYSTYPE yyv;
+  short yyss;
+  YYSTYPE yyvs;
 # if YYLSP_NEEDED
-  YYLTYPE yyl;
+  YYLTYPE yyls;
 # endif
 };
 
@@ -102,12 +102,6 @@ union yyalloc
       + YYSTACK_GAP_MAX)
 # endif
 
-# if defined (__STDC__) || defined (__cplusplus)
-#  define YYPOINTER void *
-# else
-#  define YYPOINTER char *
-# endif
-
 /* Relocate the TYPE STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    elements in the stack, and YYPTR gives the new location of the
@@ -117,12 +111,11 @@ union yyalloc
     do                                                                 \
       {                                                                        \
        YYSIZE_T yynewbytes;                                            \
-       yymemcpy (yyptr, (char *) (Stack),                              \
+       yymemcpy ((char *) yyptr, (char *) (Stack),                     \
                  yysize * (YYSIZE_T) sizeof (Type));                   \
-       (Stack) = (Type *) (YYPOINTER) yyptr;                           \
+       Stack = &yyptr->Stack;                                          \
        yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX;     \
-       yynewbytes -= yynewbytes % sizeof (union yyalloc);              \
-       yyptr += yynewbytes;                                            \
+       yyptr += yynewbytes / sizeof (*yyptr);                          \
       }                                                                        \
     while (0)
 
@@ -525,7 +518,8 @@ yyparse (YYPARSE_PARAM_ARG)
 
       {
        short *yyss1 = yyss;
-       char *yyptr = (char *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+       union yyalloc *yyptr =
+         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
        if (! yyptr)
          goto yyoverflowlab;
        YYSTACK_RELOCATE (short, yyss);