aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-01-26 16:12:50 -0800
committerRuss Cox <rsc@golang.org>2010-01-26 16:12:50 -0800
commit5f4c052e2d083f105a2e9beeda8c3279f95da998 (patch)
treef4f59011b8c857c52716672e1df2d1be226f9e17
parent090e71e7fd122a176f65a08189ac2324f073d826 (diff)
downloadgo-5f4c052e2d083f105a2e9beeda8c3279f95da998.tar.gz
go-5f4c052e2d083f105a2e9beeda8c3279f95da998.zip
gc: do not treat .6 different from .a anymore
R=ken2 CC=golang-dev https://golang.org/cl/195050
-rw-r--r--src/cmd/gc/lex.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c
index 7e2896822e..8d67b8b2d9 100644
--- a/src/cmd/gc/lex.c
+++ b/src/cmd/gc/lex.c
@@ -279,7 +279,7 @@ void
importfile(Val *f, int line)
{
Biobuf *imp;
- char *file, *p;
+ char *file;
int32 c;
int len;
Strlit *path;
@@ -301,9 +301,6 @@ importfile(Val *f, int line)
return;
}
- if(!findpkg(f->u.sval))
- fatal("can't find import: %Z", f->u.sval);
-
path = f->u.sval;
if(islocalname(path)) {
snprint(cleanbuf, sizeof cleanbuf, "%s/%s", pathname, path->s);
@@ -311,6 +308,9 @@ importfile(Val *f, int line)
path = strlit(cleanbuf);
}
+ if(!findpkg(path))
+ fatal("can't find import: %Z", f->u.sval);
+
importpkg = mkpkg(path);
imp = Bopen(namebuf, OREAD);
@@ -322,17 +322,12 @@ importfile(Val *f, int line)
if(len > 2 && namebuf[len-2] == '.' && namebuf[len-1] == 'a') {
if(!skiptopkgdef(imp))
fatal("import not package file: %s", namebuf);
-
- // assume .a files move (get installed)
- // so don't record the full path.
- p = file + len - f->u.sval->len - 2;
- linehist(p, -1, 1); // acts as #pragma lib
- } else {
- // assume .6 files don't move around
- // so do record the full path
- linehist(file, -1, 0);
}
+ // assume files move (get installed)
+ // so don't record the full path.
+ linehist(file + len - path->len - 2, -1, 1); // acts as #pragma lib
+
/*
* position the input right
* after $$ and return