Unified · Split
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | 20110404 |
| 2 | 2 | update Nt/386/bin |
| 3 | + /limbo/com.c - count constants in qualifiers, not qualifiers [issue 212, mechiel] | |
| 4 | + /appl/cmd/limbo/com.b [also issue 212] | |
| 3 | 5 | 20110403 |
| 4 | 6 | secstore(2) and secstore(1) updated to implement writing [issue 256, mechiel] |
| 5 | 7 | 20110402 |
| @@ -734,6 +734,17 @@ fillrange(c: ref Case, nn: ref Node, in: ref Inst) · 733 unmodified lines | ||
| 734 | 734 | l[i++].inst = in; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | +nconstqual(s1: ref Node): int | |
| 738 | +{ | |
| 739 | + n := 0; | |
| 740 | + for(; s1 != nil; s1 = s1.right){ | |
| 741 | + for(s2 := s1.left.left; s2 != nil; s2 = s2.right) | |
| 742 | + if(s2.left.op == Oconst) | |
| 743 | + n++; | |
| 744 | + } | |
| 745 | + return n; | |
| 746 | +} | |
| 747 | + | |
| 737 | 748 | casecom(cn: ref Node) |
| 738 | 749 | { |
| 739 | 750 | d: ref Decl; |
| @@ -742,7 +753,7 @@ casecom(cn: ref Node) · 2 unmodified lines | ||
| 742 | 753 | |
| 743 | 754 | c := cn.ty.cse; |
| 744 | 755 | |
| 745 | − needwild := cn.op != Opick || c.nlab != cn.left.right.ty.tof.decl.tag; | |
| 756 | + needwild := cn.op != Opick || nconstqual(cn.right) != cn.left.right.ty.tof.decl.tag; | |
| 746 | 757 | igoto := cn.left.ty == tint && dogoto(c); |
| 747 | 758 | |
| 748 | 759 | # |
Binary file not shown.
| @@ -768,6 +768,21 @@ fillrange(Case *c, Node *nn, Inst *in) · 767 unmodified lines | ||
| 768 | 768 | l[i++].inst = in; |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | +static int | |
| 772 | +nconstqual(Node *s1) | |
| 773 | +{ | |
| 774 | + Node *s2; | |
| 775 | + int n; | |
| 776 | + | |
| 777 | + n = 0; | |
| 778 | + for(; s1 != nil; s1 = s1->right){ | |
| 779 | + for(s2 = s1->left->left; s2 != nil; s2 = s2->right) | |
| 780 | + if(s2->left->op == Oconst) | |
| 781 | + n++; | |
| 782 | + } | |
| 783 | + return n; | |
| 784 | +} | |
| 785 | + | |
| 771 | 786 | void |
| 772 | 787 | casecom(Node *cn) |
| 773 | 788 | { |
| @@ -783,7 +798,7 @@ casecom(Node *cn) · 9 unmodified lines | ||
| 783 | 798 | |
| 784 | 799 | c = cn->ty->cse; |
| 785 | 800 | |
| 786 | − needwild = cn->op != Opick || c->nlab != cn->left->right->ty->tof->decl->tag; | |
| 801 | + needwild = cn->op != Opick || nconstqual(cn->right) != cn->left->right->ty->tof->decl->tag; | |
| 787 | 802 | igoto = cn->left->ty == tint && dogoto(c); |
| 788 | 803 | j1 = j2 = nil; |
| 789 | 804 | |