Commit 5600435f authored by Russ Cox's avatar Russ Cox

produce diagnostic for

import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561
parent 0a162a14
...@@ -97,6 +97,7 @@ dowidth(Type *t) ...@@ -97,6 +97,7 @@ dowidth(Type *t)
{ {
int32 et; int32 et;
uint32 w; uint32 w;
int lno;
if(maxround == 0 || widthptr == 0) if(maxround == 0 || widthptr == 0)
fatal("dowidth without betypeinit"); fatal("dowidth without betypeinit");
...@@ -108,11 +109,16 @@ dowidth(Type *t) ...@@ -108,11 +109,16 @@ dowidth(Type *t)
return; return;
if(t->width == -2) { if(t->width == -2) {
lno = lineno;
lineno = t->lineno;
yyerror("invalid recursive type %T", t); yyerror("invalid recursive type %T", t);
t->width = 0; t->width = 0;
lineno = lno;
return; return;
} }
lno = lineno;
lineno = t->lineno;
t->width = -2; t->width = -2;
et = t->etype; et = t->etype;
...@@ -218,6 +224,7 @@ dowidth(Type *t) ...@@ -218,6 +224,7 @@ dowidth(Type *t)
} }
t->width = w; t->width = w;
lineno = lno;
} }
void void
......
...@@ -143,6 +143,7 @@ struct Type ...@@ -143,6 +143,7 @@ struct Type
uchar deferwidth; uchar deferwidth;
Node* nod; // canonical OTYPE node Node* nod; // canonical OTYPE node
int lineno;
// TFUNCT // TFUNCT
uchar thistuple; uchar thistuple;
......
...@@ -177,14 +177,6 @@ import_stmt: ...@@ -177,14 +177,6 @@ import_stmt:
break; break;
} }
// In order to allow multifile packages to use type names
// that are the same as the package name (i.e. go/parser
// is package parser and has a type called parser), we have
// to not bother trying to declare the package if it is our package.
// TODO(rsc): Is there a better way to tell if the package is ours?
if(my == import && strcmp(import->name, package) == 0)
break;
// TODO(rsc): this line is needed for a package // TODO(rsc): this line is needed for a package
// which does bytes := in a function, which creates // which does bytes := in a function, which creates
// an ONONAME for bytes, but then a different file // an ONONAME for bytes, but then a different file
...@@ -197,7 +189,7 @@ import_stmt: ...@@ -197,7 +189,7 @@ import_stmt:
my->def = nod(OPACK, N, N); my->def = nod(OPACK, N, N);
my->def->sym = import; my->def->sym = import;
my->lastlineno = $1; my->lastlineno = $1;
import->block = -1; // above top level import->block = 1; // at top level
} }
......
...@@ -447,6 +447,7 @@ l0: ...@@ -447,6 +447,7 @@ l0:
switch(c) { switch(c) {
case EOF: case EOF:
lineno = prevlineno;
ungetc(EOF); ungetc(EOF);
return -1; return -1;
......
...@@ -392,6 +392,7 @@ typ(int et) ...@@ -392,6 +392,7 @@ typ(int et)
t = mal(sizeof(*t)); t = mal(sizeof(*t));
t->etype = et; t->etype = et;
t->width = BADWIDTH; t->width = BADWIDTH;
t->lineno = lineno;
return t; return t;
} }
......
...@@ -567,7 +567,7 @@ func exec(c *http.Conn, args []string) bool { ...@@ -567,7 +567,7 @@ func exec(c *http.Conn, args []string) bool {
} }
func sync(c *http.Conn, r *http.Request) { func dosync(c *http.Conn, r *http.Request) {
args := []string{"/bin/sh", "-c", *syncCmd}; args := []string{"/bin/sh", "-c", *syncCmd};
if !exec(c, args) { if !exec(c, args) {
*syncMin = 0; // disable sync *syncMin = 0; // disable sync
...@@ -622,7 +622,7 @@ func main() { ...@@ -622,7 +622,7 @@ func main() {
http.Handle(Pkg, http.HandlerFunc(servePkg)); http.Handle(Pkg, http.HandlerFunc(servePkg));
if *syncCmd != "" { if *syncCmd != "" {
http.Handle("/debug/sync", http.HandlerFunc(sync)); http.Handle("/debug/sync", http.HandlerFunc(dosync));
} }
http.Handle("/", http.HandlerFunc(serveFile)); http.Handle("/", http.HandlerFunc(serveFile));
...@@ -638,7 +638,7 @@ func main() { ...@@ -638,7 +638,7 @@ func main() {
log.Stderrf("sync every %dmin", *syncMin); log.Stderrf("sync every %dmin", *syncMin);
} }
for *syncMin > 0 { for *syncMin > 0 {
sync(nil, nil); dosync(nil, nil);
time.Sleep(int64(*syncMin) * (60 * 1e9)); time.Sleep(int64(*syncMin) * (60 * 1e9));
} }
if *verbose { if *verbose {
......
...@@ -161,10 +161,10 @@ BUG: 0 1 ...@@ -161,10 +161,10 @@ BUG: 0 1
BUG: errchk: command succeeded unexpectedly BUG: errchk: command succeeded unexpectedly
=========== bugs/bug190.go =========== bugs/bug190.go
<epoch>: invalid recursive type []S bugs/bug190.go:11: invalid recursive type []S
<epoch>: invalid recursive type S bugs/bug190.go:16: invalid recursive type S
<epoch>: invalid recursive type S bugs/bug190.go:16: invalid recursive type S
<epoch>: invalid recursive type chan S bugs/bug190.go:13: invalid recursive type chan S
<epoch>: invalid recursive type S bugs/bug190.go:16: invalid recursive type S
<epoch>: invalid recursive type func(S) (S) bugs/bug190.go:15: invalid recursive type func(S) (S)
BUG: should compile BUG: should compile
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment