handle intorcard_type better in case statements
This commit is contained in:
parent
73ac23824b
commit
5252b760d9
|
@ -832,13 +832,11 @@ ChkBinOper(expp)
|
|||
tpl = BaseType(expp->nd_left->nd_type);
|
||||
tpr = BaseType(expp->nd_right->nd_type);
|
||||
|
||||
if (tpl == intorcard_type) {
|
||||
if (tpr == int_type || tpr == card_type) {
|
||||
if (intorcard(tpl, tpr) != 0) {
|
||||
if (tpl == intorcard_type) {
|
||||
expp->nd_left->nd_type = tpl = tpr;
|
||||
}
|
||||
}
|
||||
if (tpr == intorcard_type) {
|
||||
if (tpl == int_type || tpl == card_type) {
|
||||
if (tpr == intorcard_type) {
|
||||
expp->nd_right->nd_type = tpr = tpl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -400,7 +400,11 @@ CaseLabels(t_type **ptp; register t_node **pnd;)
|
|||
}:
|
||||
ConstExpression(pnd)
|
||||
{
|
||||
if (*ptp != 0 && ChkCompat(pnd, *ptp, "case label")) {
|
||||
if (*ptp != 0) {
|
||||
t_type *tp = intorcard(*ptp,
|
||||
BaseType((*pnd)->nd_type), 0);
|
||||
if (tp) *ptp = tp;
|
||||
ChkCompat(pnd, *ptp, "case label");
|
||||
}
|
||||
nd = *pnd;
|
||||
nd->nd_type = BaseType(nd->nd_type); /* ??? */
|
||||
|
|
|
@ -187,6 +187,7 @@ extern t_type
|
|||
*proc_type(),
|
||||
*enum_type(),
|
||||
*qualified_type(),
|
||||
*intorcard(),
|
||||
*RemoveEqual(); /* All from type.c */
|
||||
|
||||
#define NULLTYPE ((t_type *) 0)
|
||||
|
|
|
@ -795,6 +795,23 @@ lcm(m, n)
|
|||
return m * (n / gcd(m, n));
|
||||
}
|
||||
|
||||
t_type *
|
||||
intorcard(left, right)
|
||||
register t_type *left, *right;
|
||||
{
|
||||
if (left == intorcard_type) {
|
||||
if (right == int_type || right == card_type) {
|
||||
return right;
|
||||
}
|
||||
}
|
||||
else if (right == intorcard_type) {
|
||||
if (left == int_type || left == card_type) {
|
||||
return left;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DumpType(tp)
|
||||
register t_type *tp;
|
||||
|
|
Loading…
Reference in a new issue