From c417e38a68a434502922501799bcf86a15a42221 Mon Sep 17 00:00:00 2001 From: Charles Forsyth Date: Sat, 31 Oct 2015 11:06:38 +0000 Subject: suppress cyclic errors by default; -y to enable them --- limbo/limbo.h | 1 + limbo/limbo.y | 3 +++ limbo/typecheck.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'limbo') 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", -- cgit v1.2.3