mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 02:33:03 +00:00
skeletons: avoid empty switch constructs
Reported by Rob Conde. http://lists.gnu.org/archive/html/bug-bison/2013-03/msg00003.html * data/c.m4 (b4_symbol_actions): Rename as... (_b4_symbol_actions): this. (b4_symbol_actions): New wrapper. Do not emit empty switches. Adjust all b4_symbol_actions callers.
This commit is contained in:
38
data/c.m4
38
data/c.m4
@@ -440,15 +440,15 @@ m4_define([b4_case],
|
|||||||
$2
|
$2
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
# b4_symbol_actions(FILENAME, LINENO,
|
# _b4_symbol_actions(FILENAME, LINENO,
|
||||||
# SYMBOL-TAG, SYMBOL-NUM,
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
# -------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Issue the code for a symbol action (e.g., %printer).
|
# Issue the code for a symbol action (e.g., %printer).
|
||||||
#
|
#
|
||||||
# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
|
# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
|
||||||
# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
|
# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
|
||||||
m4_define([b4_symbol_actions],
|
m4_define([_b4_symbol_actions],
|
||||||
[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
|
[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
|
||||||
case $4: /* $3 */
|
case $4: /* $3 */
|
||||||
b4_syncline([$2], [$1])
|
b4_syncline([$2], [$1])
|
||||||
@@ -458,6 +458,20 @@ b4_syncline([@oline@], [@ofile@])
|
|||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# b4_symbol_actions(KIND)
|
||||||
|
# -----------------------
|
||||||
|
# Emit the symbol actions for KIND ("printers" or "destructors").
|
||||||
|
# Dispatch on "yytype".
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_ifval(m4_defn([b4_symbol_$1]),
|
||||||
|
[[switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([_b4_symbol_actions], m4_defn([b4_symbol_$1]))[
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}]],
|
||||||
|
[YYUSE (yytype);])])
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
@@ -487,12 +501,7 @@ b4_parse_param_use[]dnl
|
|||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
switch (yytype)
|
]b4_symbol_actions([destructors])[
|
||||||
{
|
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -530,12 +539,7 @@ b4_parse_param_use[]dnl
|
|||||||
# else
|
# else
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
# endif
|
# endif
|
||||||
switch (yytype)
|
]b4_symbol_actions([printers])[
|
||||||
{
|
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -167,12 +167,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
std::ostream& yyoutput = debug_stream ();
|
std::ostream& yyoutput = debug_stream ();
|
||||||
std::ostream& yyo = yyoutput;
|
std::ostream& yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
switch (yytype)
|
]b4_symbol_actions([printers])[
|
||||||
{
|
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -422,12 +422,7 @@ do { \
|
|||||||
std::ostream& yyo = debug_stream ();
|
std::ostream& yyo = debug_stream ();
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
switch (yytype)
|
]b4_symbol_actions([printers])[
|
||||||
{
|
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -454,12 +449,7 @@ do { \
|
|||||||
if (yymsg)
|
if (yymsg)
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
switch (yytype)
|
]b4_symbol_actions([destructors])[
|
||||||
{
|
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user