bison-patches
[Top][All Lists]
Advanced

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

[PATCH 03/12] yacc.c: style: avoid macros


From: Akim Demaille
Subject: [PATCH 03/12] yacc.c: style: avoid macros
Date: Thu, 16 Jan 2020 07:58:14 +0100

* data/skeletons/yacc.c (YYSYNTAX_ERROR): Remove, the call is now
sufficiently small so that we can afford to duplicate it.
---
 data/skeletons/yacc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 4f088036..ff53b8d0 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1789,25 +1789,26 @@ yyerrlab:
          [simple],
 [[      yyerror (]b4_yyerror_args[YY_("syntax error"));]],
          [verbose],
-[[# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, &yyctx)
-      {
+[[      {
         char const *yymsgp = YY_("syntax error");
         yyparse_context_t yyctx
           = {yyssp, yytoken]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])[};
         int yysyntax_error_status;]b4_lac_if([[
         if (yychar != YYEMPTY)
           YY_LAC_ESTABLISH;]])[
-        yysyntax_error_status = YYSYNTAX_ERROR;
+        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
         if (yysyntax_error_status == 0)
           yymsgp = yymsg;
         else if (yysyntax_error_status == 1)
           {
             if (yymsg != yymsgbuf)
               YYSTACK_FREE (yymsg);
-            yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, 
yymsg_alloc)));
+            yymsg = YY_CAST (char *,
+                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
             if (yymsg)
               {
-                yysyntax_error_status = YYSYNTAX_ERROR;
+                yysyntax_error_status
+                  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
                 yymsgp = yymsg;
               }
             else
@@ -1820,8 +1821,7 @@ yyerrlab:
         yyerror (]b4_yyerror_args[yymsgp);
         if (yysyntax_error_status == 2)
           goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR]])[
+      }]])[
     }
 
 ]b4_locations_if([[  yyerror_range[1] = yylloc;]])[
-- 
2.24.1




reply via email to

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