[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: push parser
From: |
Joel E. Denny |
Subject: |
Re: push parser |
Date: |
Mon, 18 Dec 2006 16:52:26 -0500 (EST) |
On Mon, 18 Dec 2006, Joel E. Denny wrote:
> > Thanks for looking into it. My, there is a lot of clever code here
> > without much explanation.... But I'll give some quick feedback anyway.
>
> I should document the push.c changes better. I got too lazy at the end of
> that coding session. Maybe later today.
By the way, thanks for the feedback regardless of my laziness.
> > + YYCOPY (&yyptr->Stack##_alloc, Stack, yysize); \
> > + Stack = &yyptr->Stack##_alloc; \
> >
> > The current yacc.c doesn't use ##, since ## is not portable to K&R C.
>
> Thanks, I think I can work around that.
Below is a small uncommitted patch against CVS Bison. It implements a
different solution to the above in preparation for my larger patch posted
earlier. Ok to commit?
Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1627
diff -p -u -r1.1627 ChangeLog
--- ChangeLog 18 Dec 2006 17:27:23 -0000 1.1627
+++ ChangeLog 18 Dec 2006 21:19:07 -0000
@@ -1,3 +1,12 @@
+2006-12-18 Joel E. Denny <address@hidden>
+
+ * data/push.c (union yyalloc): Rename yyss, yyvs, and yyls fields to
+ prevent a name collision in a future patch where these names will
+ sometimes be #define'd.
+ (YYSTACK_RELOCATE): Add an argument to select a union yyalloc field
+ since it no longer has the same name as the existing argument.
+ (yyparse or yypush_parse): Update all uses of YYSTACK_RELOCATE.
+
2006-12-18 Paul Eggert <address@hidden>
* src/symtab.h (struct semantic_type): Remove the tag 'semantic_type',
Index: data/push.c
===================================================================
RCS file: /sources/bison/bison/data/push.c,v
retrieving revision 1.17
diff -p -u -r1.17 push.c
--- data/push.c 17 Dec 2006 01:33:31 -0000 1.17
+++ data/push.c 18 Dec 2006 21:19:07 -0000
@@ -373,9 +373,9 @@ void free (void *); /* INFRINGES ON USER
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- ]b4_locations_if([ YYLTYPE yyls;
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+ ]b4_locations_if([ YYLTYPE yyls_alloc;
])dnl
[};
@@ -415,12 +415,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{
\
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
}
\
@@ -1277,9 +1277,9 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-]b4_locations_if([ YYSTACK_RELOCATE (yyls);])[
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+]b4_locations_if([ YYSTACK_RELOCATE (yyls_alloc, yyls);])[
# undef YYSTACK_RELOCATE
if (yyss1 != ]b4_yyssa[)
YYSTACK_FREE (yyss1);
- Re: push parser, (continued)
- Re: push parser, Bob Rossi, 2006/12/16
- Re: push parser, Joel E. Denny, 2006/12/18
- Re: push parser, Bob Rossi, 2006/12/18
- Re: push parser, Joel E. Denny, 2006/12/18
- Re: push parser, Bob Rossi, 2006/12/18
- Re: push parser, Paul Eggert, 2006/12/18
- Re: push parser, Joel E. Denny, 2006/12/18
- Re: push parser, Paul Eggert, 2006/12/18
- Re: push parser, Joel E. Denny, 2006/12/18
- Re: push parser, Joel E. Denny, 2006/12/18
- Re: push parser,
Joel E. Denny <=
- Re: push parser, Joel E. Denny, 2006/12/19
- Re: push parser, Joel E. Denny, 2006/12/19
- Re: push parser, Paul Eggert, 2006/12/19
- Re: push parser, Joel E. Denny, 2006/12/19
- Re: push parser, Paul Eggert, 2006/12/19
- Re: push parser, Joel E. Denny, 2006/12/19
- Re: push parser, Paul Eggert, 2006/12/20
- Re: push parser, Joel E. Denny, 2006/12/20
- Re: push parser, Joel E. Denny, 2006/12/20
- Re: push parser, Joel E. Denny, 2006/12/20