eggert@twinsun.com (Paul Eggert) (11/11/89)
In Bison 1.03 (ChangeLog: Wed Aug 23 15:03:07 1989 Jay Fenlason (hack at gnu)), bison.simple and output.c create C code that sometimes contains unused objects. Here is a fix. *** old/bison.simple Fri Nov 10 15:40:11 1989 --- new/bison.simple Fri Nov 10 14:46:54 1989 *************** *** 94,100 **** --- 94,102 ---- register int yyn; register short *yyssp; register YYSTYPE *yyvsp; + #ifdef YYLSP_NEEDED YYLTYPE *yylsp; + #endif int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1; /* lookahead token as an internal (translated) token number */ *************** *** 137,143 **** --- 139,147 ---- yyssp = yyss - 1; yyvsp = yyvs; + #ifdef YYLSP_NEEDED yylsp = yyls; + #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks *************** *** 151,157 **** --- 155,163 ---- /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; + #if defined (yyoverflow) || defined (YYLSP_NEEDED) YYLTYPE *yyls1 = yyls; + #endif short *yyss1 = yyss; /* Get the current used size of the three stacks, in elements. */ *************** *** 161,169 **** /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ yyoverflow("parser stack overflow", ! &yyss1, size * sizeof (*yyssp), ! &yyvs1, size * sizeof (*yyvsp), ! &yyls1, size * sizeof (*yylsp), &yymaxdepth); yyss = yyss1; yyvs = yyvs1; yyls = yyls1; --- 167,175 ---- /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ yyoverflow("parser stack overflow", ! &yyss1, size * sizeof (*yyss1), ! &yyvs1, size * sizeof (*yyvs1), ! &yyls1, size * sizeof (*yyls1), &yymaxdepth); yyss = yyss1; yyvs = yyvs1; yyls = yyls1; *** old/output.c Fri Nov 10 15:40:12 1989 --- new/output.c Fri Nov 10 14:52:49 1989 *************** *** 383,389 **** register int i; register int j; ! fprintf(ftable, "\nstatic const short yyrline[] = { 0"); j = 10; for (i = 1; i <= nrules; i++) --- 383,389 ---- register int i; register int j; ! fprintf(ftable, "\n#if YYDEBUG != 0\nstatic const short yyrline[] = { 0"); j = 10; for (i = 1; i <= nrules; i++) *************** *** 442,448 **** putc ('\"', ftable); } ! fprintf(ftable, "\n};\n\nstatic const short yyr1[] = { 0"); j = 10; for (i = 1; i <= nrules; i++) --- 442,448 ---- putc ('\"', ftable); } ! fprintf(ftable, "\n};\n#endif\n\nstatic const short yyr1[] = { 0"); j = 10; for (i = 1; i <= nrules; i++)