From: Akim Demaille Date: Thu, 20 Jun 2002 09:22:56 +0000 (+0000) Subject: * data/bison.simple (YYDSYMPRINT): New. X-Git-Tag: BISON-1_49b~143 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/253862fd4c3faf4e42802859b43b55220fbc7cb4 * data/bison.simple (YYDSYMPRINT): New. Use it to remove many of the #if YYDEBUG/if (yydebug). --- diff --git a/ChangeLog b/ChangeLog index 93daaaa0..b0fde66a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-06-20 Akim Demaille + + * data/bison.simple (YYDSYMPRINT): New. + Use it to remove many of the #if YYDEBUG/if (yydebug). + 2002-06-20 Akim Demaille * src/symtab.h, src/symtab.c (symbol_t): printer and diff --git a/data/bison.simple b/data/bison.simple index 906f3139..b56c0e16 100644 --- a/data/bison.simple +++ b/data/bison.simple @@ -556,11 +556,17 @@ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ @@ -886,16 +892,11 @@ yybackup: { yychar1 = YYTRANSLATE (yychar); -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - YYFPRINTF (stderr, "Next token is "); - yysymprint (stderr, yychar1, yylval]b4_location_if([, yyloc])[); - YYFPRINTF (stderr, "\n"); - } -#endif + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ + YYDPRINTF ((stderr, "Next token is ")); + YYDSYMPRINT ((stderr, yychar1, yylval]b4_location_if([, yyloc])[)); + YYDPRINTF ((stderr, "\n")); } yyn += yychar1; @@ -1109,16 +1110,11 @@ yyerrlab1: /* Pop the rest of the stack. */ while (yyssp > yyss) { -#if YYDEBUG - if (yydebug) - { - YYFPRINTF (stderr, "Error: popping "); - yysymprint (stderr, - yystos[*yyssp], - *yyvsp]b4_location_if([, *yylsp])[); - YYFPRINTF (stderr, "\n"); - } -#endif + YYDPRINTF ((stderr, "Error: popping ")); + YYDSYMPRINT ((stderr, + yystos[*yyssp], + *yyvsp]b4_location_if([, *yylsp])[)); + YYDPRINTF ((stderr, "\n")); yydestructor (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[); YYPOPSTACK; } @@ -1154,16 +1150,10 @@ yyerrlab1: if (yyssp == yyss) YYABORT; -#if YYDEBUG - if (yydebug) - { - YYFPRINTF (stderr, "Error: popping "); - yysymprint (stderr, - yystos[*yyssp], - *yyvsp]b4_location_if([, *yylsp])[); - YYFPRINTF (stderr, "\n"); - } -#endif + YYDPRINTF ((stderr, "Error: popping ")); + YYDSYMPRINT ((stderr, + yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[)); + YYDPRINTF ((stderr, "\n")); yydestructor (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[); yyvsp--;