bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

two portability patches for data/yacc.c


From: Paul Eggert
Subject: two portability patches for data/yacc.c
Date: Sun, 09 Jul 2006 00:39:29 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

I installed this:

2006-07-09  Paul Eggert  <address@hidden>

        * data/yacc.c (YYID, yy_stack_print): Prefix local vars with "yy"
        so they don't collide with user-defined macros.
        (yy_stack_print): Don't assume that yytype_int16 promotes to int;
        this was never guaranteed, and now that we're using gnulib stdint,
        which defines int_fast16_t to long int, the problem is exposed.

--- data/yacc.c 8 Jul 2006 20:38:14 -0000       1.148
+++ data/yacc.c 9 Jul 2006 07:32:13 -0000
@@ -286,9 +286,9 @@ typedef short int yytype_int16;
 #ifndef lint
 # define YYID(n) (n)
 #else
-]b4_c_function_def([YYID], [static int], [[int i], [i]])[
+]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -673,12 +673,15 @@ do {                                                      
                  \
 `------------------------------------------------------------------*/
 
 ]b4_c_function_def([yy_stack_print], [static void],
-                  [[yytype_int16 *bottom], [bottom]],
-                  [[yytype_int16 *top],    [top]])[
+                  [[yytype_int16 *yybottom], [yybottom]],
+                  [[yytype_int16 *yytop],    [yytop]])[
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]