c.m4: better newline control with b4_parse_param_use.

* data/c.m4: Use m4_ifvaln instead of m4_ifval where
applicable.
(b4_parse_param_use): Switch order between two nested
"if"s to avoid useless empty lines.
Adjust callers to avoid useless lines.
This commit is contained in:
Akim Demaille
2012-03-15 14:42:15 +01:00
parent fc25770394
commit 1e5d654019
2 changed files with 9 additions and 12 deletions

View File

@@ -124,10 +124,8 @@ m4_popdef([$1])dnl
# -------------------------------- # --------------------------------
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params. # `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
m4_define([b4_parse_param_use], m4_define([b4_parse_param_use],
[m4_ifval([$1], [ YYUSE([$1]); [m4_ifvaln([$1], [ YYUSE([$1]);])dnl
])dnl b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
m4_ifval([$2], [b4_locations_if([ YYUSE ([$2]);
])])dnl
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
])dnl ])dnl
]) ])
@@ -188,8 +186,7 @@ m4_define([b4_null], [0])
# ------------------------------------------------------------- # -------------------------------------------------------------
# Define "yy<TABLE-NAME>" which contents is CONTENT. # Define "yy<TABLE-NAME>" which contents is CONTENT.
m4_define([b4_integral_parser_table_define], m4_define([b4_integral_parser_table_define],
[m4_ifval([$3], [b4_c_comment([$3], [ ]) [m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
])dnl
static const b4_int_type_for([$2]) yy$1[[]] = static const b4_int_type_for([$2]) yy$1[[]] =
{ {
$2 $2
@@ -448,8 +445,8 @@ m4_define_default([b4_yydestruct_generate],
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[ m4_ifset([b4_parse_param], [, b4_parse_param]))[
{ {
]b4_parse_param_use([yyvaluep], [yylocationp])[ ]b4_parse_param_use([yyvaluep], [yylocationp])dnl
if (!yymsg) [ if (!yymsg)
yymsg = "Deleting"; yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
@@ -483,8 +480,8 @@ m4_define_default([b4_yy_symbol_print_generate],
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[ m4_ifset([b4_parse_param], [, b4_parse_param]))[
{ {
]b4_parse_param_use([yyoutput], [yylocationp])[ ]b4_parse_param_use([yyoutput], [yylocationp])dnl
if (!yyvaluep) [ if (!yyvaluep)
return;] return;]
dnl glr.c does not feature yytoknum. dnl glr.c does not feature yytoknum.
m4_if(b4_skeleton, ["yacc.c"], m4_if(b4_skeleton, ["yacc.c"],

View File

@@ -852,8 +852,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
yybool yynormal __attribute__ ((__unused__)) = yybool yynormal __attribute__ ((__unused__)) =
(yystackp->yysplitPoint == NULL); (yystackp->yysplitPoint == NULL);
int yylow; int yylow;
]b4_parse_param_use([yyvalp], [yylocp])[ ]b4_parse_param_use([yyvalp], [yylocp])dnl
# undef yyerrok [# undef yyerrok
# define yyerrok (yystackp->yyerrState = 0) # define yyerrok (yystackp->yyerrState = 0)
# undef YYACCEPT # undef YYACCEPT
# define YYACCEPT return yyaccept # define YYACCEPT return yyaccept