mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.cc] cmd/internal/obj, cmd/internal/gc, new6g: reconvert
Reconvert using rsc.io/c2go rev 27b3f59. Changes to converter: - fatal does not return, so no fallthrough after fatal in switch - many more function results and variables identified as bool - simplification of negated boolean expressions Change-Id: I3bc67da5e46cb7ee613e230cf7e9533036cc870b Reviewed-on: https://go-review.googlesource.com/5171 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
786825c5e8
commit
dc7b54bed2
67 changed files with 2410 additions and 2509 deletions
|
|
@ -31,50 +31,6 @@
|
|||
|
||||
package obj
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func addlib(ctxt *Link, src, obj, pathname string) {
|
||||
name := path.Clean(pathname)
|
||||
|
||||
// runtime.a -> runtime
|
||||
short := strings.TrimSuffix(name, ".a")
|
||||
|
||||
// already loaded?
|
||||
for i := range ctxt.Library {
|
||||
if ctxt.Library[i].Pkg == short {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var pname string
|
||||
// runtime -> runtime.a for search
|
||||
if (!(ctxt.Windows != 0) && name[0] == '/') || (ctxt.Windows != 0 && name[1] == ':') {
|
||||
pname = name
|
||||
} else {
|
||||
// try dot, -L "libdir", and then goroot.
|
||||
for _, dir := range ctxt.Libdir {
|
||||
pname = dir + "/" + name
|
||||
if _, err := os.Stat(pname); !os.IsNotExist(err) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
pname = path.Clean(pname)
|
||||
|
||||
// runtime.a -> runtime
|
||||
pname = strings.TrimSuffix(pname, ".a")
|
||||
|
||||
if ctxt.Debugvlog > 1 && ctxt.Bso != nil {
|
||||
fmt.Fprintf(ctxt.Bso, "%5.2f addlib: %s %s pulls in %s\n", Cputime(), obj, src, pname)
|
||||
}
|
||||
Addlibpath(ctxt, src, obj, pname, name)
|
||||
}
|
||||
|
||||
/*
|
||||
* add library to library list.
|
||||
* srcref: src file referring to package
|
||||
|
|
@ -82,24 +38,6 @@ func addlib(ctxt *Link, src, obj, pathname string) {
|
|||
* file: object file, e.g., /home/rsc/go/pkg/container/vector.a
|
||||
* pkg: package import path, e.g. container/vector
|
||||
*/
|
||||
func Addlibpath(ctxt *Link, srcref, objref, file, pkg string) {
|
||||
for _, lib := range ctxt.Library {
|
||||
if lib.File == file {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ctxt.Debugvlog > 1 && ctxt.Bso != nil {
|
||||
fmt.Fprintf(ctxt.Bso, "%5.2f addlibpath: srcref: %s objref: %s file: %s pkg: %s\n", Cputime(), srcref, objref, file, pkg)
|
||||
}
|
||||
|
||||
ctxt.Library = append(ctxt.Library, Library{
|
||||
Objref: objref,
|
||||
Srcref: srcref,
|
||||
File: file,
|
||||
Pkg: pkg,
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
LOG = 5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue