]> Cypherpunks repositories - gostls13.git/commitdiff
stop using filename for disambiguation within a package.
authorRuss Cox <rsc@golang.org>
Thu, 3 Sep 2009 22:23:21 +0000 (15:23 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 3 Sep 2009 22:23:21 +0000 (15:23 -0700)
R=ken
OCL=34339
CL=34341

src/cmd/gc/closure.c
src/cmd/gc/go.h
src/cmd/gc/init.c
src/cmd/gc/lex.c
src/cmd/gc/subr.c

index 46bb2d785346814f692909654afdce122efc660a..2f102993c6fa9b2aa7b604e7ca313ac07b32cd68 100644 (file)
@@ -152,7 +152,7 @@ walkclosure(Node *func, NodeList **init)
 
        // create the function
        xfunc = nod(ODCLFUNC, N, N);
-       snprint(namebuf, sizeof namebuf, "_f%.3ld·%s", ++closgen, filename);
+       snprint(namebuf, sizeof namebuf, "_f%.3ld", ++closgen);
        xfunc->nname = newname(lookup(namebuf));
        xfunc->nname->ntype = xtype;
        declare(xfunc->nname, PFUNC);
index b4cf07a7545935f9cfde5a17163d51e7014fe512..e9dd4bc339ee380b3f4ebf86e472468b88db587a 100644 (file)
@@ -617,7 +617,6 @@ EXTERN      Sym*    pkgimportname;  // package name from imported package
 EXTERN int     tptr;           // either TPTR32 or TPTR64
 extern char*   sysimport;
 extern char*   unsafeimport;
-EXTERN char*   filename;       // name to uniqify names
 EXTERN Idir*   idirs;
 
 EXTERN Type*   types[NTYPE];
@@ -696,7 +695,6 @@ int yyparse(void);
 /*
  *     lex.c
  */
-void   setfilename(char*);
 void   addidir(char*);
 void   importfile(Val*);
 void   cannedimports(char*, char*);
index 555f4e89021fb1d7df2b3e4b982177f15e9f9730..6e31b732523102a87f230c448445ccb7d9aaad8b 100644 (file)
@@ -9,7 +9,7 @@
  * it is called by the initialization before
  * main is run. to make it unique within a
  * package and also uncallable, the name,
- * normally "pkg.init", is altered to "pkg.init·filename".
+ * normally "pkg.init", is altered to "pkg.init·1".
  */
 Node*
 renameinit(Node *n)
index f9ce1a148324e717870b92b309fed72981115091..bcd27b08193bbb3e02e6da9f4e6951ea1455a56a 100644 (file)
@@ -76,8 +76,6 @@ main(int argc, char *argv[])
        lexlineno = 1;
 
        for(i=0; i<argc; i++) {
-               if(i == 0)
-                       setfilename(argv[i]);
                infile = argv[i];
                linehist(infile, 0, 0);
 
@@ -149,29 +147,6 @@ usage:
        return 0;
 }
 
-void
-setfilename(char *file)
-{
-       char *p;
-       int c;
-
-       p = strrchr(file, '/');
-       if(p != nil)
-               file = p+1;
-       strncpy(namebuf, file, sizeof(namebuf));
-       p = strrchr(namebuf, '.');
-       if(p != nil && strcmp(p, ".go") == 0)
-               *p = 0;
-       filename = strdup(namebuf);
-
-       // turn invalid identifier chars into _
-       for(p=filename; *p; p++) {
-               c = *p & 0xFF;
-               if(c < 0x80 && !isalpha(c) && !isdigit(c) && c != '_')
-                       *p = '_';
-       }
-}
-
 int
 arsize(Biobuf *b, char *name)
 {
index 8b75560158cb7653d5f8f6c3df8640dff08594e0..1cc568f4b664035c27f9d7cf5a9657901652c908 100644 (file)
@@ -973,11 +973,8 @@ Tpretty(Fmt *fp, Type *t)
                                return 0;
                        if(s->flags & SymImported)
                                return 0;
-                       if(t->vargen || !(s->flags & (SymExport|SymPackage))) {
-                               fmtprint(fp, "·%s", filename);
-                               if(t->vargen)
-                                       fmtprint(fp, "·%d", t->vargen);
-                       }
+                       if(t->vargen)
+                               fmtprint(fp, "·%d", t->vargen);
                        return 0;
                }
                return fmtprint(fp, "%S", s);
@@ -2227,7 +2224,7 @@ staticname(Type *t)
 {
        Node *n;
 
-       snprint(namebuf, sizeof(namebuf), "statictmp_%.4d·%s", statuniqgen, filename);
+       snprint(namebuf, sizeof(namebuf), "statictmp_%.4d", statuniqgen);
        statuniqgen++;
        n = newname(lookup(namebuf));
        addvar(n, t, PEXTERN);