fixed a small problem with the 'symmetric' option; also fixed a

problem with Hex numbers
This commit is contained in:
ceriel 1988-04-19 14:40:27 +00:00
parent fef0bf1075
commit 9d3f9ea496
3 changed files with 20 additions and 19 deletions

View file

@ -434,7 +434,7 @@ again:
else { else {
state = End; state = End;
if (ch == 'H') base = 16; if (ch == 'H') base = 16;
UnloadChar(ch); else UnloadChar(ch);
} }
break; break;

View file

@ -101,14 +101,15 @@ MkCoercion(pnd, tp)
wmess = "conversion"; wmess = "conversion";
} }
break; break;
case T_INTEGER: { case T_INTEGER:
long i = min_int[(int)(tp->tp_size)]; if (! chk_bounds(nd->nd_INT,
long j = nd->nd_INT & i; max_int[(int)(tp->tp_size)],
nd_tp->tp_fund) ||
if (j != 0 && (nd_tp->tp_fund != T_INTEGER || j != i)) { ! chk_bounds(min_int[(int)(tp->tp_size)],
nd->nd_INT,
T_INTEGER)) {
wmess = "conversion"; wmess = "conversion";
} }
}
break; break;
} }
if (wmess) { if (wmess) {
@ -818,7 +819,6 @@ ChkBinOper(expp)
{ {
/* Check a binary operation. /* Check a binary operation.
*/ */
register t_node *left = expp->nd_left, *right = expp->nd_right;
register t_type *tpl, *tpr; register t_type *tpl, *tpr;
t_type *result_type; t_type *result_type;
int allowed; int allowed;
@ -826,19 +826,19 @@ ChkBinOper(expp)
/* First, check BOTH operands */ /* First, check BOTH operands */
retval = ChkExpression(left) & ChkExpression(right); retval = ChkExpression(expp->nd_left) & ChkExpression(expp->nd_right);
tpl = BaseType(left->nd_type); tpl = BaseType(expp->nd_left->nd_type);
tpr = BaseType(right->nd_type); tpr = BaseType(expp->nd_right->nd_type);
if (tpl == intorcard_type) { if (tpl == intorcard_type) {
if (tpr == int_type || tpr == card_type) { if (tpr == int_type || tpr == card_type) {
left->nd_type = tpl = tpr; expp->nd_left->nd_type = tpl = tpr;
} }
} }
if (tpr == intorcard_type) { if (tpr == intorcard_type) {
if (tpl == int_type || tpl == card_type) { if (tpl == int_type || tpl == card_type) {
right->nd_type = tpr = tpl; expp->nd_right->nd_type = tpr = tpl;
} }
} }
@ -863,12 +863,11 @@ ChkBinOper(expp)
I don't know! Should we be allowed to check I don't know! Should we be allowed to check
if a INTEGER is a member of a BITSET??? if a INTEGER is a member of a BITSET???
*/ */
node_error(left, "type incompatibility in IN"); node_error(expp->nd_left, "type incompatibility in IN");
return 0; return 0;
} }
MkCoercion(&(expp->nd_left), word_type); MkCoercion(&(expp->nd_left), word_type);
left = expp->nd_left; if (expp->nd_left->nd_class == Value && expp->nd_right->nd_class == Set) {
if (left->nd_class == Value && right->nd_class == Set) {
cstset(expp); cstset(expp);
} }
return retval; return retval;
@ -901,12 +900,14 @@ ChkBinOper(expp)
} }
if (tpl->tp_fund == T_SET) { if (tpl->tp_fund == T_SET) {
if (left->nd_class == Set && right->nd_class == Set) { if (expp->nd_left->nd_class == Set &&
expp->nd_right->nd_class == Set) {
cstset(expp); cstset(expp);
} }
} }
else if ( tpl->tp_fund != T_REAL && else if ( tpl->tp_fund != T_REAL &&
left->nd_class == Value && right->nd_class == Value) { expp->nd_left->nd_class == Value &&
expp->nd_right->nd_class == Value) {
if (expp->nd_left->nd_type->tp_fund == T_INTEGER) { if (expp->nd_left->nd_type->tp_fund == T_INTEGER) {
cstibin(expp); cstibin(expp);
} }

View file

@ -208,7 +208,7 @@ _error(class, node, ap)
switch (class) { switch (class) {
case WARNING: case WARNING:
case LEXWARNING: case LEXWARNING:
if (! warn_class & warning_classes) return; if (! (warn_class & warning_classes)) return;
switch(warn_class) { switch(warn_class) {
#ifndef STRICT_3RD_ED #ifndef STRICT_3RD_ED
case W_OLDFASHIONED: case W_OLDFASHIONED: