summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Forsyth <charles.forsyth@gmail.com>2015-10-31 11:06:38 +0000
committerCharles Forsyth <charles.forsyth@gmail.com>2015-10-31 11:06:38 +0000
commitc417e38a68a434502922501799bcf86a15a42221 (patch)
tree18d6f2443808b803c8d1466082da3507d85b3b29
parenta3b48c04d0cbf55ffa78314786dacbb437db10ab (diff)
suppress cyclic errors by default; -y to enable them
-rw-r--r--limbo/limbo.h1
-rw-r--r--limbo/limbo.y3
-rw-r--r--limbo/typecheck.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/limbo/limbo.h b/limbo/limbo.h
index 7e63e898..fa3fd0da 100644
--- a/limbo/limbo.h
+++ b/limbo/limbo.h
@@ -625,6 +625,7 @@ Extern int maxerr;
Extern int maxlabdep; /* maximum nesting of breakable/continuable statements */
Extern long maxstack; /* max size of a stack frame called */
Extern int mustcompile; /* dis header flag */
+Extern int oldcycles;
Extern int nadts;
Extern int newfnptr; /* ISELF and -ve indices */
Extern int nfns;
diff --git a/limbo/limbo.y b/limbo/limbo.y
index 5342c92d..a6ccab90 100644
--- a/limbo/limbo.y
+++ b/limbo/limbo.y
@@ -1774,6 +1774,9 @@ main(int argc, char *argv[])
case 'X':
signdump = ARGF();
break;
+ case 'y':
+ oldcycles = 1;
+ break;
case 'z':
arrayz = 1;
break;
diff --git a/limbo/typecheck.c b/limbo/typecheck.c
index 8f1e2bb3..52e0295d 100644
--- a/limbo/typecheck.c
+++ b/limbo/typecheck.c
@@ -2155,13 +2155,15 @@ circlval(Node *n, Node *lval)
case Oname:
break;
case Odot:
- if(n->right->decl->cycle && !n->right->decl->cyc){
+ if(oldcycles && n->right->decl->cycle && !n->right->decl->cyc){
nerror(lval, "cannot assign to %V because field '%s' of %V could complete a cycle to %V",
lval, n->right->decl->sym->name, n->left, n->left);
return -1;
}
return 1;
case Oind:
+ if(!oldcycles)
+ return 1;
for(id = n->ty->ids; id != nil; id = id->next){
if(id->cycle && !id->cyc){
nerror(lval, "cannot assign to %V because field '%s' of %V could complete a cycle to %V",