]> Cypherpunks repositories - gostls13.git/commitdiff
produce diagnostic for
authorRuss Cox <rsc@golang.org>
Thu, 20 Aug 2009 00:27:08 +0000 (17:27 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 20 Aug 2009 00:27:08 +0000 (17:27 -0700)
import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561

src/cmd/gc/align.c
src/cmd/gc/go.h
src/cmd/gc/go.y
src/cmd/gc/lex.c
src/cmd/gc/subr.c
src/cmd/godoc/godoc.go
test/golden.out

index 34f3e9c84a546b27cacef5315f52cf669b9652ea..81ea9a7fe83ffbc1738a0b6d430eec2e8fb839cc 100644 (file)
@@ -97,6 +97,7 @@ dowidth(Type *t)
 {
        int32 et;
        uint32 w;
+       int lno;
 
        if(maxround == 0 || widthptr == 0)
                fatal("dowidth without betypeinit");
@@ -108,11 +109,16 @@ dowidth(Type *t)
                return;
 
        if(t->width == -2) {
+               lno = lineno;
+               lineno = t->lineno;
                yyerror("invalid recursive type %T", t);
                t->width = 0;
+               lineno = lno;
                return;
        }
 
+       lno = lineno;
+       lineno = t->lineno;
        t->width = -2;
 
        et = t->etype;
@@ -218,6 +224,7 @@ dowidth(Type *t)
        }
 
        t->width = w;
+       lineno = lno;
 }
 
 void
index b4fcd4befc1775c8e3cfb9a0616cd63e488b0d6b..d709c3974f8536cc9fc47234dc2cfb9b84ae3ca7 100644 (file)
@@ -143,6 +143,7 @@ struct      Type
        uchar   deferwidth;
 
        Node*   nod;            // canonical OTYPE node
+       int             lineno;
 
        // TFUNCT
        uchar   thistuple;
index 129e77d6d77ff76d714f3d626d3be75d8a337dfc..dfee62293b4262a16b08060444b535ed59ea0bcd 100644 (file)
@@ -177,14 +177,6 @@ import_stmt:
                        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
                // which does bytes := in a function, which creates
                // an ONONAME for bytes, but then a different file
@@ -197,7 +189,7 @@ import_stmt:
                my->def = nod(OPACK, N, N);
                my->def->sym = import;
                my->lastlineno = $1;
-               import->block = -1;     // above top level
+               import->block = 1;      // at top level
        }
        
 
index 7e9e8d5b35b39313cea80c8c2fdf68a84fba24d6..f9ce1a148324e717870b92b309fed72981115091 100644 (file)
@@ -447,6 +447,7 @@ l0:
 
        switch(c) {
        case EOF:
+               lineno = prevlineno;
                ungetc(EOF);
                return -1;
 
index 7a7259ca3eb787ce9af073995db5c6fff1af1efb..d4e62e6f97698a80fbe526e22001f336ed14ddff 100644 (file)
@@ -392,6 +392,7 @@ typ(int et)
        t = mal(sizeof(*t));
        t->etype = et;
        t->width = BADWIDTH;
+       t->lineno = lineno;
        return t;
 }
 
index f7ba3dbbe43520f86d79534f27233bfa077a3cfc..34b03aaae92fc0af41ef114d03a1a1e3ae823ea4 100644 (file)
@@ -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};
        if !exec(c, args) {
                *syncMin = 0;  // disable sync
@@ -622,7 +622,7 @@ func main() {
 
                http.Handle(Pkg, http.HandlerFunc(servePkg));
                if *syncCmd != "" {
-                       http.Handle("/debug/sync", http.HandlerFunc(sync));
+                       http.Handle("/debug/sync", http.HandlerFunc(dosync));
                }
                http.Handle("/", http.HandlerFunc(serveFile));
 
@@ -638,7 +638,7 @@ func main() {
                                        log.Stderrf("sync every %dmin", *syncMin);
                                }
                                for *syncMin > 0 {
-                                       sync(nil, nil);
+                                       dosync(nil, nil);
                                        time.Sleep(int64(*syncMin) * (60 * 1e9));
                                }
                                if *verbose {
index f3841b15b164ba64e938841478d9946930cb9543..1c4981b352bbf4829e25fc637f907bac1460270f 100644 (file)
@@ -161,10 +161,10 @@ BUG: 0 1
 BUG: errchk: command succeeded unexpectedly
 
 =========== bugs/bug190.go
-<epoch>: invalid recursive type []S
-<epoch>: invalid recursive type S
-<epoch>: invalid recursive type S
-<epoch>: invalid recursive type chan S
-<epoch>: invalid recursive type S
-<epoch>: invalid recursive type func(S) (S)
+bugs/bug190.go:11: invalid recursive type []S
+bugs/bug190.go:16: invalid recursive type S
+bugs/bug190.go:16: invalid recursive type S
+bugs/bug190.go:13: invalid recursive type chan S
+bugs/bug190.go:16: invalid recursive type S
+bugs/bug190.go:15: invalid recursive type func(S) (S)
 BUG: should compile