cleaned up a little
This commit is contained in:
parent
cfc1d926bf
commit
013a6f9cd6
1 changed files with 17 additions and 12 deletions
|
@ -393,7 +393,7 @@ new_oper(tp, e1, oper, e2)
|
||||||
}
|
}
|
||||||
|
|
||||||
chk_cst_expr(expp)
|
chk_cst_expr(expp)
|
||||||
register struct expr **expp;
|
struct expr **expp;
|
||||||
{
|
{
|
||||||
/* The expression expr is checked for constancy.
|
/* The expression expr is checked for constancy.
|
||||||
|
|
||||||
|
@ -416,26 +416,31 @@ chk_cst_expr(expp)
|
||||||
Preprocessor #if) have to be dealt with locally
|
Preprocessor #if) have to be dealt with locally
|
||||||
*/
|
*/
|
||||||
register struct expr *expr = *expp;
|
register struct expr *expr = *expp;
|
||||||
register int fund = expr->ex_type->tp_fund;
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
print_expr("constant_expression", expr);
|
print_expr("constant_expression", expr);
|
||||||
#endif DEBUG
|
#endif DEBUG
|
||||||
if ( fund != CHAR && fund != SHORT && fund != INT
|
switch(expr->ex_type->tp_fund) {
|
||||||
&& fund != ENUM && fund != LONG) {
|
case CHAR:
|
||||||
expr_error(expr, "non-numerical constant expression");
|
case SHORT:
|
||||||
err++;
|
case INT:
|
||||||
} else if (!is_ld_cst(expr)) {
|
case ENUM:
|
||||||
|
case LONG:
|
||||||
|
if (is_ld_cst(expr)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
expr_error(expr, "expression is not constant");
|
expr_error(expr, "expression is not constant");
|
||||||
err++;
|
break;
|
||||||
|
default:
|
||||||
|
expr_error(expr, "non-numerical constant expression");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (err)
|
erroneous2int(expp);
|
||||||
erroneous2int(expp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_expression(eppp, expr)
|
init_expression(eppp, expr)
|
||||||
register struct expr ***eppp, *expr;
|
register struct expr ***eppp;
|
||||||
|
struct expr *expr;
|
||||||
{
|
{
|
||||||
/* The expression expr is added to the tree designated
|
/* The expression expr is added to the tree designated
|
||||||
indirectly by **eppp.
|
indirectly by **eppp.
|
||||||
|
|
Loading…
Reference in a new issue