From 66c247ba9cf7dc6d8051532ba3e707b948d8709d Mon Sep 17 00:00:00 2001 From: dick Date: Sun, 28 Sep 1986 20:33:15 +0000 Subject: [PATCH] some very minor changes --- lang/cem/cemcom/arith.c | 19 +++++++++++-------- lang/cem/cemcom/declar.g | 2 +- lang/cem/cemcom/declarator.c | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lang/cem/cemcom/arith.c b/lang/cem/cemcom/arith.c index 51382e41f..bcf6047c9 100644 --- a/lang/cem/cemcom/arith.c +++ b/lang/cem/cemcom/arith.c @@ -141,24 +141,27 @@ any2arith(expp, oper) case LONG: break; case ENUM: + /* test the admissibility of the operator */ if ( is_test_op(oper) || oper == '=' || oper == PARCOMMA || - oper == ',' || oper == ':' || - ( !options['R'] && - (is_arith_op(oper) || is_asgn_op(oper)) - ) - ) - {} + oper == ',' || oper == ':' + ) { + /* allowed by K & R */ + } + else + if (!options['R']) { + /* allowed by us */ + } else expr_warning(*expp, "%s on enum", symbol2str(oper)); int2int(expp, int_type); break; -#ifndef NOFLOAT +#ifndef NOFLOAT case FLOAT: float2float(expp, double_type); break; case DOUBLE: break; -#endif NOFLOAT +#endif NOFLOAT #ifndef NOBITFIELD case FIELD: field2arith(expp); diff --git a/lang/cem/cemcom/declar.g b/lang/cem/cemcom/declar.g index ac6535c95..71f8202a8 100644 --- a/lang/cem/cemcom/declar.g +++ b/lang/cem/cemcom/declar.g @@ -208,7 +208,7 @@ arrayer(arith *sizep;) [ constant_expression(&expr) { - array_subscript(expr); + check_array_subscript(expr); *sizep = expr->VL_VALUE; free_expression(expr); } diff --git a/lang/cem/cemcom/declarator.c b/lang/cem/cemcom/declarator.c index ff79ab0a1..f74705fb1 100644 --- a/lang/cem/cemcom/declarator.c +++ b/lang/cem/cemcom/declarator.c @@ -89,7 +89,7 @@ reject_params(dc) } } -array_subscript(expr) +check_array_subscript(expr) register struct expr *expr; { arith size = expr->VL_VALUE; @@ -104,7 +104,7 @@ array_subscript(expr) expr->VL_VALUE = (arith)-1; } else - if (size & ~max_unsigned) { /* absolute ridiculous */ + if (size & ~max_unsigned) { /* absolutely ridiculous */ expr_error(expr, "overflow in array size"); expr->VL_VALUE = (arith)1; } -- 2.34.1