bison-patches
[Top][All Lists]
Advanced

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

yacc.c: simplify use of YYDPRINTF


From: Akim Demaille
Subject: yacc.c: simplify use of YYDPRINTF
Date: Thu, 9 Jan 2020 21:35:14 +0100

commit 2116af766acf267146d5a796f4a5488d4b259315
Author: Akim Demaille <address@hidden>
Date:   Mon Jan 6 20:09:49 2020 +0100

    yacc.c: simplify use of YYDPRINTF
    
    * data/skeletons/yacc.c (YYDPRINTF): Expand to no-op (instead of
    nothing) when disabled.
    Simplify callers.

diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 0aeb7142..6143f96d 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -764,7 +764,7 @@ do {                                    \
    multiple parsers can coexist.  */
 int yydebug;
 #else /* !]b4_api_PREFIX[DEBUG */
-# define YYDPRINTF(Args)
+# define YYDPRINTF(Args) ((void) 0)
 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
 # define YY_STACK_PRINT(Bottom, Top)
 # define YY_REDUCE_PRINT(Rule)
@@ -914,9 +914,8 @@ do {                                                        
     \
 do {                                                                     \
   if (yy_lac_established)                                                \
     {                                                                    \
-      if (yydebug)                                                       \
-        YYFPRINTF (stderr, "LAC: initial context discarded due to "      \
-                   Event "\n");                                          \
+      YYDPRINTF ((stderr, "LAC: initial context discarded due to "       \
+                  Event "\n"));                                          \
       yy_lac_established = 0;                                            \
     }                                                                    \
 } while (0)
@@ -1211,10 +1210,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
                 yyarg[yycount++] = yytname[yyx];
               }
         }]b4_lac_if([[
-# if ]b4_api_PREFIX[DEBUG
-      else if (yydebug)
-        YYFPRINTF (stderr, "No expected tokens.\n");
-# endif]])[
+      else
+        YYDPRINTF ((stderr, "No expected tokens.\n"));]])[
     }
 
   switch (yycount)




reply via email to

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