testing enums in switches/cases

This commit is contained in:
dick
1988-09-30 16:43:04 +00:00
parent b0c8f9748a
commit ff682c0cfc
4 changed files with 16 additions and 12 deletions

View File

@@ -189,13 +189,15 @@ ch7cast(expp, oper, tp)
int i = is_integral_type(tp);
if (oldi && i) {
if ( oldtp->tp_fund == ENUM &&
tp->tp_fund == ENUM &&
oper != CAST
)
if ( oper != CAST
&& ( tp->tp_fund == ENUM
|| oldtp->tp_fund == ENUM
)
) {
expr_warning(*expp,
"%s on enums of different types",
"dubious %s on enum",
symbol2str(oper));
}
#ifdef LINT
if (oper == CAST)
(*expp)->ex_type = tp;