[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] m4: decommission b4_function_declare
From: |
Akim Demaille |
Subject: |
[PATCH 2/3] m4: decommission b4_function_declare |
Date: |
Mon, 2 Mar 2020 07:01:14 +0100 |
* data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/yacc.c:
Stop using b4_function_declare.
---
data/skeletons/glr.c | 5 +++--
data/skeletons/glr.cc | 11 ++++-------
data/skeletons/yacc.c | 30 +++++++++++-------------------
3 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index a1bcebc5..ed8d75e0 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -159,7 +159,7 @@ m4_if(b4_skeleton, ["glr.c"],
]b4_percent_code_get([[requires]])[
]b4_token_enums[
]b4_declare_yylstype[
-]b4_function_declare(b4_prefix[parse], [int], b4_parse_param)[
+int ]b4_prefix[parse (]m4_ifset([b4_parse_param],
[b4_formals(b4_parse_param)], [void])[);
]b4_percent_code_get([[provides]])[]dnl
])
])
@@ -2394,7 +2394,8 @@ yyrecoverSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
| yyparse. |
`----------*/
-]b4_function_define([yyparse], [int], b4_parse_param)[
+int
+yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
{
int yyresult;
yyGLRStack yystack;
diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc
index f1d26c87..a6b26cc3 100644
--- a/data/skeletons/glr.cc
+++ b/data/skeletons/glr.cc
@@ -95,13 +95,10 @@ m4_defn([b4_initial_action])]))])[
# Hijack the post prologue to declare yyerror.
]m4_append([b4_post_prologue],
[b4_syncline([@oline@], [@ofile@])dnl
-b4_function_declare([yyerror],
- [static void],b4_locations_if([
- [[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
- [yylocationp]],])
- b4_parse_param,
- [[const char* msg], [msg]])])[
-
+[static void
+yyerror (]b4_locations_if([[const
]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
+ ]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
+ ])[const char* msg);]])[
#undef yynerrs
#undef yychar
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 9982f77f..db2b3efd 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -231,27 +231,20 @@ enum { YYPUSH_MORE = 4 };
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
-]b4_pull_if([b4_function_declare([b4_prefix[parse]], [[int]], b4_parse_param)
-])b4_function_declare([b4_prefix[push_parse]], [[int]],
- [[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
- [[[int pushed_char]], [[pushed_char]]],
- [[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
- [[b4_api_PREFIX[LTYPE *pushed_loc]],
[[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
- b4_parse_param]))
-b4_pull_if([b4_function_declare([b4_prefix[pull_parse]], [[int]],
- [[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
- b4_parse_param]))])
-b4_function_declare([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
- [[[void]], []])
-b4_function_declare([b4_prefix[pstate_delete]], [[void]],
- [[b4_prefix[pstate *ps]], [[ps]]])dnl
-])
+]b4_pull_if([[
+int ]b4_prefix[parse (]m4_ifset([b4_parse_param],
[b4_formals(b4_parse_param)], [void])[);]])[
+int ]b4_prefix[push_parse (]b4_prefix[pstate *ps]b4_pure_if([[,
+ int pushed_char, ]b4_api_PREFIX[STYPE const
*pushed_val]b4_locations_if([[, ]b4_api_PREFIX[LTYPE
*pushed_loc]])])b4_user_formals[);
+]b4_pull_if([[int ]b4_prefix[pull_parse (]b4_prefix[pstate
*ps]b4_user_formals[);]])[
+]b4_prefix[pstate *]b4_prefix[pstate_new (void);
+void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps);
+]])
# _b4_declare_yyparse
# -------------------
# When not the push parser.
m4_define([_b4_declare_yyparse],
-[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
+[[int ]b4_prefix[parse (]m4_ifset([b4_parse_param],
[b4_formals(b4_parse_param)], [void])[);]])
# b4_declare_yyparse
@@ -1193,9 +1186,8 @@ yyparse_context_location (const yyparse_context_t *yyctx)
}]])[
/* User defined function to report a syntax error. */
-]b4_function_declare([yyreport_syntax_error], [static int],
- [[[const yyparse_context_t *yyctx]], [[yyctx]]],
- b4_parse_param)],
+static int
+yyreport_syntax_error (const yyparse_context_t *yyctx]b4_user_formals[);]],
[simple],
[[]],
[[#ifndef yystrlen
--
2.25.1