m4: decommission b4_function_declare

* data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/yacc.c:
Stop using b4_function_declare.
This commit is contained in:
Akim Demaille
2020-03-02 04:38:50 +01:00
parent 4cca30d2e6
commit 79c3f2b8fd
3 changed files with 18 additions and 28 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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