cmd/compile/internal/gc: unexport more helper functions

After the removal of the old backend many types are no longer referenced
outside internal/gc. Make these functions private so that tools like
honnef.co/go/unused can spot when they become dead code. In doing so
this CL identified several previously public helpers which are no longer
used, so removes them.

This should be the last of the public functions.

Change-Id: I7e9c4e72f86f391b428b9dddb6f0d516529706c3
Reviewed-on: https://go-review.googlesource.com/29134
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Dave Cheney 2016-09-15 15:45:10 +10:00
parent 896ac677b5
commit d7012ca282
37 changed files with 713 additions and 720 deletions

View file

@ -106,7 +106,7 @@ func Main() {
defer hidePanic()
Ctxt = obj.Linknew(Thearch.LinkArch)
Ctxt.DiagFunc = Yyerror
Ctxt.DiagFunc = yyerror
Ctxt.Bso = bufio.NewWriter(os.Stdout)
localpkg = mkpkg("")
@ -506,7 +506,7 @@ func Main() {
errorexit()
}
Flusherrors()
flusherrors()
timings.Stop()
if benchfile != "" {
@ -631,7 +631,7 @@ func findpkg(name string) (file string, ok bool) {
// don't want to see "encoding/../encoding/base64"
// as different from "encoding/base64".
if q := path.Clean(name); q != name {
Yyerror("non-canonical import path %q (should be %q)", name, q)
yyerror("non-canonical import path %q (should be %q)", name, q)
return "", false
}
@ -698,12 +698,12 @@ func importfile(f *Val, indent []byte) {
path_, ok := f.U.(string)
if !ok {
Yyerror("import statement not a string")
yyerror("import statement not a string")
return
}
if len(path_) == 0 {
Yyerror("import path is empty")
yyerror("import path is empty")
return
}
@ -716,12 +716,12 @@ func importfile(f *Val, indent []byte) {
// the main package, just as we reserve the import
// path "math" to identify the standard math package.
if path_ == "main" {
Yyerror("cannot import \"main\"")
yyerror("cannot import \"main\"")
errorexit()
}
if myimportpath != "" && path_ == myimportpath {
Yyerror("import %q while compiling that package (import cycle)", path_)
yyerror("import %q while compiling that package (import cycle)", path_)
errorexit()
}
@ -731,7 +731,7 @@ func importfile(f *Val, indent []byte) {
if path_ == "unsafe" {
if safemode {
Yyerror("cannot import package unsafe")
yyerror("cannot import package unsafe")
errorexit()
}
@ -742,7 +742,7 @@ func importfile(f *Val, indent []byte) {
if islocalname(path_) {
if path_[0] == '/' {
Yyerror("import path cannot be absolute path")
yyerror("import path cannot be absolute path")
return
}
@ -759,7 +759,7 @@ func importfile(f *Val, indent []byte) {
file, found := findpkg(path_)
if !found {
Yyerror("can't find import: %q", path_)
yyerror("can't find import: %q", path_)
errorexit()
}
@ -773,7 +773,7 @@ func importfile(f *Val, indent []byte) {
impf, err := os.Open(file)
if err != nil {
Yyerror("can't open import: %q: %v", path_, err)
yyerror("can't open import: %q: %v", path_, err)
errorexit()
}
defer impf.Close()
@ -781,7 +781,7 @@ func importfile(f *Val, indent []byte) {
if strings.HasSuffix(file, ".a") {
if !skiptopkgdef(imp) {
Yyerror("import %s: not a package file", file)
yyerror("import %s: not a package file", file)
errorexit()
}
}
@ -797,13 +797,13 @@ func importfile(f *Val, indent []byte) {
if p != "empty archive" {
if !strings.HasPrefix(p, "go object ") {
Yyerror("import %s: not a go object file: %s", file, p)
yyerror("import %s: not a go object file: %s", file, p)
errorexit()
}
q := fmt.Sprintf("%s %s %s %s", obj.GOOS, obj.GOARCH, obj.Version, obj.Expstring())
if p[10:] != q {
Yyerror("import %s: object is [%s] expected [%s]", file, p[10:], q)
yyerror("import %s: object is [%s] expected [%s]", file, p[10:], q)
errorexit()
}
}
@ -824,7 +824,7 @@ func importfile(f *Val, indent []byte) {
}
}
if safemode && !safe {
Yyerror("cannot import unsafe package %q", importpkg.Path)
yyerror("cannot import unsafe package %q", importpkg.Path)
}
// assume files move (get installed)
@ -857,7 +857,7 @@ func importfile(f *Val, indent []byte) {
switch c {
case '\n':
Yyerror("cannot import %s: old export format no longer supported (recompile library)", path_)
yyerror("cannot import %s: old export format no longer supported (recompile library)", path_)
case 'B':
if Debug_export != 0 {
@ -867,7 +867,7 @@ func importfile(f *Val, indent []byte) {
Import(imp)
default:
Yyerror("no import in %q", path_)
yyerror("no import in %q", path_)
errorexit()
}
}
@ -893,12 +893,12 @@ func pkgnotused(lineno int32, path string, name string) {
func mkpackage(pkgname string) {
if localpkg.Name == "" {
if pkgname == "_" {
Yyerror("invalid package name _")
yyerror("invalid package name _")
}
localpkg.Name = pkgname
} else {
if pkgname != localpkg.Name {
Yyerror("package %s; expected %s", pkgname, localpkg.Name)
yyerror("package %s; expected %s", pkgname, localpkg.Name)
}
for _, s := range localpkg.Syms {
if s.Def == nil {