]> Cypherpunks repositories - gostls13.git/commitdiff
gc: correct buffer size in sprint, add -L to show full paths
authorRuss Cox <rsc@golang.org>
Thu, 30 Sep 2010 19:02:43 +0000 (15:02 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 30 Sep 2010 19:02:43 +0000 (15:02 -0400)
R=ken2
CC=golang-dev
https://golang.org/cl/2338041

src/cmd/gc/doc.go
src/cmd/gc/lex.c
src/cmd/gc/subr.c

index 108a091b281fb2518d317ec378ee0aae81d8a709..7798f9bf85fda75079d704d7dcf7aa4346c0d2c7 100644 (file)
@@ -32,6 +32,8 @@ Flags:
                output file, default 6.out for 6g, etc.
        -e
                normally the compiler quits after 10 errors; -e prints all errors
+       -L
+               show entire file path when printing line numbers in errors
        -I dir1 -I dir2
                add dir1 and dir2 to the list of paths to check for imported packages
        -N
index 8289648ba97572549086a512f4a8e7f120a0f275..05fe4e7f2ae431d26e69b54af4445ac914b83859 100644 (file)
@@ -436,7 +436,9 @@ importfile(Val *f, int line)
        path = f->u.sval;
        if(islocalname(path)) {
                cleanbuf = mal(strlen(pathname) + strlen(path->s) + 2);
-               sprint(cleanbuf, "%s/%s", pathname, path->s);
+               strcpy(cleanbuf, pathname);
+               strcat(cleanbuf, "/");
+               strcat(cleanbuf, path->s);
                cleanname(cleanbuf);
                path = strlit(cleanbuf);
        }
index 91a012187fdb220b7fb68658009069bbbcb28dbf..00f213e18fae912adb82f13065cb9c7515d3295e 100644 (file)
@@ -934,6 +934,8 @@ Lconv(Fmt *fp)
                                break;
                        fmtprint(fp, " ");
                }
+               if(debug['L'])
+                       fmtprint(fp, "%s/", pathname);
                if(a[i].line)
                        fmtprint(fp, "%s:%ld[%s:%ld]",
                                a[i].line->name, lno-a[i].ldel+1,