History

20110404-1906

forsyth committed 15 years ago

Commit e7a0dbf1 parent d7b39e14 files · +29 −1Browse files

Unified · Split

4 files
  1. CHANGES +2 −0
  2. appl/cmd/limbo/com.b +12 −1
  3. dis/limbo.dis +0 −0
  4. limbo/com.c +16 −1
CHANGES+2−0
@@ -1,5 +1,7 @@
11 20110404
22 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]
35 20110403
46 secstore(2) and secstore(1) updated to implement writing [issue 256, mechiel]
57 20110402
appl/cmd/limbo/com.b+12−1
@@ -734,6 +734,17 @@ fillrange(c: ref Case, nn: ref Node, in: ref Inst) · 733 unmodified lines
734734 l[i++].inst = in;
735735 }
736736
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+
737748 casecom(cn: ref Node)
738749 {
739750 d: ref Decl;
@@ -742,7 +753,7 @@ casecom(cn: ref Node) · 2 unmodified lines
742753
743754 c := cn.ty.cse;
744755
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;
746757 igoto := cn.left.ty == tint && dogoto(c);
747758
748759 #
dis/limbo.dis+0−0

Binary file not shown.

limbo/com.c+16−1
@@ -768,6 +768,21 @@ fillrange(Case *c, Node *nn, Inst *in) · 767 unmodified lines
768768 l[i++].inst = in;
769769 }
770770
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+
771786 void
772787 casecom(Node *cn)
773788 {
@@ -783,7 +798,7 @@ casecom(Node *cn) · 9 unmodified lines
783798
784799 c = cn->ty->cse;
785800
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;
787802 igoto = cn->left->ty == tint && dogoto(c);
788803 j1 = j2 = nil;
789804