* src/reader.c (reader): #define YYLSP_NEEDED to 1 instead of just

defining.
* src/bison.s1: s/#ifdef YYLSP_NEEDED/#if YYLSP_NEEDED/.
This commit is contained in:
Akim Demaille
2000-11-07 15:56:20 +00:00
parent 553e2b222f
commit 5af1f54933
4 changed files with 49 additions and 43 deletions

View File

@@ -1,3 +1,9 @@
2000-11-07 Akim Demaille <akim@epita.fr>
* src/reader.c (reader): #define YYLSP_NEEDED to 1 instead of just
defining.
* src/bison.s1: s/#ifdef YYLSP_NEEDED/#if YYLSP_NEEDED/.
2000-11-07 Akim Demaille <akim@epita.fr> 2000-11-07 Akim Demaille <akim@epita.fr>
* src/bison.s1 (YYLEX): Use #if instead of #ifdef. * src/bison.s1 (YYLEX): Use #if instead of #ifdef.

View File

@@ -120,7 +120,7 @@ while (0)
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#if YYPURE #if YYPURE
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
# ifdef YYLEX_PARAM # ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
# else # else
@@ -147,7 +147,7 @@ int yychar;
/* The semantic value of the lookahead symbol. */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; YYSTYPE yylval;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
/* Location data for the lookahead symbol. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc; YYLTYPE yylloc;
# endif # endif
@@ -291,14 +291,14 @@ yyparse (YYPARSE_PARAM_ARG)
YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp; register YYSTYPE *yyvsp;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
/* The location stack. */ /* The location stack. */
YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa; YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp; YYLTYPE *yylsp;
#endif #endif
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else #else
# define YYPOPSTACK (yyvsp--, yyssp--) # define YYPOPSTACK (yyvsp--, yyssp--)
@@ -311,7 +311,7 @@ yyparse (YYPARSE_PARAM_ARG)
int yychar; int yychar;
YYSTYPE yylval; YYSTYPE yylval;
int yynerrs; int yynerrs;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
YYLTYPE yylloc; YYLTYPE yylloc;
# endif # endif
#endif /* !YYPURE */ #endif /* !YYPURE */
@@ -320,7 +320,7 @@ yyparse (YYPARSE_PARAM_ARG)
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
YYLTYPE yyloc; YYLTYPE yyloc;
# endif # endif
@@ -342,7 +342,7 @@ yyparse (YYPARSE_PARAM_ARG)
yyssp = yyss - 1; yyssp = yyss - 1;
yyvsp = yyvs; yyvsp = yyvs;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp = yyls; yylsp = yyls;
#endif #endif
@@ -363,7 +363,7 @@ yynewstate:
*/ */
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss; short *yyss1 = yyss;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
YYLTYPE *yyls1 = yyls; YYLTYPE *yyls1 = yyls;
#endif #endif
@@ -373,7 +373,7 @@ yynewstate:
#ifdef yyoverflow #ifdef yyoverflow
/* Each stack pointer address is followed by the size of /* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */ the data in use in that stack, in bytes. */
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
/* This used to be a conditional around just the two extra args, /* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */ but that might be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow", yyoverflow ("parser stack overflow",
@@ -389,7 +389,7 @@ yynewstate:
# endif # endif
yyss = yyss1; yyvs = yyvs1; yyss = yyss1; yyvs = yyvs1;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
yyls = yyls1; yyls = yyls1;
# endif # endif
#else /* no yyoverflow */ #else /* no yyoverflow */
@@ -401,7 +401,7 @@ yynewstate:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
free (yyls); free (yyls);
# endif # endif
} }
@@ -419,7 +419,7 @@ yynewstate:
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1, __yy_memcpy ((char *)yyvs, (char *)yyvs1,
size * (unsigned int) sizeof (*yyvsp)); size * (unsigned int) sizeof (*yyvsp));
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, __yy_memcpy ((char *)yyls, (char *)yyls1,
size * (unsigned int) sizeof (*yylsp)); size * (unsigned int) sizeof (*yylsp));
@@ -428,7 +428,7 @@ yynewstate:
yyssp = yyss + size - 1; yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1; yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp = yyls + size - 1; yylsp = yyls + size - 1;
#endif #endif
@@ -532,7 +532,7 @@ yybackup:
yychar = YYEMPTY; yychar = YYEMPTY;
*++yyvsp = yylval; *++yyvsp = yylval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yylloc; *++yylsp = yylloc;
#endif #endif
@@ -571,7 +571,7 @@ yyreduce:
unconditionally makes the parser a bit smaller, and it avoids a unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */ GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
/* Implement default location. If the rhs is empty, extend YYLOC to /* Implement default location. If the rhs is empty, extend YYLOC to
YYLLOC, which corresponds to the current token, otherwise YYLLOC, which corresponds to the current token, otherwise
implement `@{dollar} = Starts at @1, ends at @YYLEN'. */ implement `@{dollar} = Starts at @1, ends at @YYLEN'. */
@@ -610,7 +610,7 @@ $ /* The action file replaces this line marked with this dollarsign. */
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp -= yylen; yylsp -= yylen;
#endif #endif
@@ -626,7 +626,7 @@ $ /* The action file replaces this line marked with this dollarsign. */
#endif #endif
*++yyvsp = yyval; *++yyvsp = yyval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yyloc; *++yylsp = yyloc;
#endif #endif
@@ -754,7 +754,7 @@ yyerrpop:
YYABORT; YYABORT;
yyvsp--; yyvsp--;
yystate = *--yyssp; yystate = *--yyssp;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp--; yylsp--;
#endif #endif
@@ -798,7 +798,7 @@ yyerrhandle:
YYDPRINTF ((stderr, "Shifting error token, ")); YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval; *++yyvsp = yylval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yylloc; *++yylsp = yylloc;
#endif #endif
@@ -814,7 +814,7 @@ yyacceptlab:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
free (yyls); free (yyls);
#endif #endif
} }
@@ -829,7 +829,7 @@ yyabortlab:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
free (yyls); free (yyls);
#endif #endif
} }

View File

@@ -120,7 +120,7 @@ while (0)
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#if YYPURE #if YYPURE
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
# ifdef YYLEX_PARAM # ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
# else # else
@@ -147,7 +147,7 @@ int yychar;
/* The semantic value of the lookahead symbol. */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; YYSTYPE yylval;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
/* Location data for the lookahead symbol. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc; YYLTYPE yylloc;
# endif # endif
@@ -291,14 +291,14 @@ yyparse (YYPARSE_PARAM_ARG)
YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp; register YYSTYPE *yyvsp;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
/* The location stack. */ /* The location stack. */
YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa; YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp; YYLTYPE *yylsp;
#endif #endif
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else #else
# define YYPOPSTACK (yyvsp--, yyssp--) # define YYPOPSTACK (yyvsp--, yyssp--)
@@ -311,7 +311,7 @@ yyparse (YYPARSE_PARAM_ARG)
int yychar; int yychar;
YYSTYPE yylval; YYSTYPE yylval;
int yynerrs; int yynerrs;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
YYLTYPE yylloc; YYLTYPE yylloc;
# endif # endif
#endif /* !YYPURE */ #endif /* !YYPURE */
@@ -320,7 +320,7 @@ yyparse (YYPARSE_PARAM_ARG)
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
YYLTYPE yyloc; YYLTYPE yyloc;
# endif # endif
@@ -342,7 +342,7 @@ yyparse (YYPARSE_PARAM_ARG)
yyssp = yyss - 1; yyssp = yyss - 1;
yyvsp = yyvs; yyvsp = yyvs;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp = yyls; yylsp = yyls;
#endif #endif
@@ -363,7 +363,7 @@ yynewstate:
*/ */
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss; short *yyss1 = yyss;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
YYLTYPE *yyls1 = yyls; YYLTYPE *yyls1 = yyls;
#endif #endif
@@ -373,7 +373,7 @@ yynewstate:
#ifdef yyoverflow #ifdef yyoverflow
/* Each stack pointer address is followed by the size of /* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */ the data in use in that stack, in bytes. */
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
/* This used to be a conditional around just the two extra args, /* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */ but that might be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow", yyoverflow ("parser stack overflow",
@@ -389,7 +389,7 @@ yynewstate:
# endif # endif
yyss = yyss1; yyvs = yyvs1; yyss = yyss1; yyvs = yyvs1;
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
yyls = yyls1; yyls = yyls1;
# endif # endif
#else /* no yyoverflow */ #else /* no yyoverflow */
@@ -401,7 +401,7 @@ yynewstate:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
free (yyls); free (yyls);
# endif # endif
} }
@@ -419,7 +419,7 @@ yynewstate:
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1, __yy_memcpy ((char *)yyvs, (char *)yyvs1,
size * (unsigned int) sizeof (*yyvsp)); size * (unsigned int) sizeof (*yyvsp));
# ifdef YYLSP_NEEDED # if YYLSP_NEEDED
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, __yy_memcpy ((char *)yyls, (char *)yyls1,
size * (unsigned int) sizeof (*yylsp)); size * (unsigned int) sizeof (*yylsp));
@@ -428,7 +428,7 @@ yynewstate:
yyssp = yyss + size - 1; yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1; yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp = yyls + size - 1; yylsp = yyls + size - 1;
#endif #endif
@@ -532,7 +532,7 @@ yybackup:
yychar = YYEMPTY; yychar = YYEMPTY;
*++yyvsp = yylval; *++yyvsp = yylval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yylloc; *++yylsp = yylloc;
#endif #endif
@@ -571,7 +571,7 @@ yyreduce:
unconditionally makes the parser a bit smaller, and it avoids a unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */ GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
/* Implement default location. If the rhs is empty, extend YYLOC to /* Implement default location. If the rhs is empty, extend YYLOC to
YYLLOC, which corresponds to the current token, otherwise YYLLOC, which corresponds to the current token, otherwise
implement `@{dollar} = Starts at @1, ends at @YYLEN'. */ implement `@{dollar} = Starts at @1, ends at @YYLEN'. */
@@ -610,7 +610,7 @@ $ /* The action file replaces this line marked with this dollarsign. */
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp -= yylen; yylsp -= yylen;
#endif #endif
@@ -626,7 +626,7 @@ $ /* The action file replaces this line marked with this dollarsign. */
#endif #endif
*++yyvsp = yyval; *++yyvsp = yyval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yyloc; *++yylsp = yyloc;
#endif #endif
@@ -754,7 +754,7 @@ yyerrpop:
YYABORT; YYABORT;
yyvsp--; yyvsp--;
yystate = *--yyssp; yystate = *--yyssp;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
yylsp--; yylsp--;
#endif #endif
@@ -798,7 +798,7 @@ yyerrhandle:
YYDPRINTF ((stderr, "Shifting error token, ")); YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval; *++yyvsp = yylval;
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
*++yylsp = yylloc; *++yylsp = yylloc;
#endif #endif
@@ -814,7 +814,7 @@ yyacceptlab:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
free (yyls); free (yyls);
#endif #endif
} }
@@ -829,7 +829,7 @@ yyabortlab:
{ {
free (yyss); free (yyss);
free (yyvs); free (yyvs);
#ifdef YYLSP_NEEDED #if YYLSP_NEEDED
free (yyls); free (yyls);
#endif #endif
} }

View File

@@ -1975,7 +1975,7 @@ reader (void)
/* Write closing delimiters for actions and guards. */ /* Write closing delimiters for actions and guards. */
output_trailers (); output_trailers ();
if (locations_flag) if (locations_flag)
obstack_grow_literal_string (&table_obstack, "#define YYLSP_NEEDED\n\n"); obstack_grow_literal_string (&table_obstack, "#define YYLSP_NEEDED 1\n\n");
/* Assign the symbols their symbol numbers. Write #defines for the /* Assign the symbols their symbol numbers. Write #defines for the
token symbols into FDEFINES if requested. */ token symbols into FDEFINES if requested. */
packsymbols (); packsymbols ();