]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: remove dead code
authorDave Cheney <dave@cheney.net>
Tue, 15 Mar 2016 03:02:08 +0000 (14:02 +1100)
committerDave Cheney <dave@cheney.net>
Tue, 15 Mar 2016 06:02:13 +0000 (06:02 +0000)
Partial automatic cleanup driven by Dominik Honnef's unused tool.

As _lookup now only has one caller, merge it into the caller and remove
the conditional create logic.

Change-Id: I2ea354d9d4b32a19905271eca74725231b6d8a93
Reviewed-on: https://go-review.googlesource.com/20589
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/obj/flag.go
src/cmd/internal/obj/pcln.go
src/cmd/internal/obj/sym.go

index 998098e3fc0a20dd4a5f8992a883d7d66f1fbd48..ff69fd9d575fd4d33268df5d65e91ed53725e29e 100644 (file)
@@ -80,11 +80,6 @@ func (c *count) IsBoolFlag() bool {
 
 type int32Value int32
 
-func newIntValue(val int32, p *int32) *int32Value {
-       *p = val
-       return (*int32Value)(p)
-}
-
 func (i *int32Value) Set(s string) error {
        v, err := strconv.ParseInt(s, 0, 64)
        *i = int32Value(v)
index 577d80a1d6c8c4cdf10831199a79a10248ac76ad..3ed4ecfd8dbd89a46f506d29cf13aee94ff78738 100644 (file)
@@ -278,61 +278,3 @@ func linkpcln(ctxt *Link, cursym *LSym) {
                }
        }
 }
-
-// iteration over encoded pcdata tables.
-
-func getvarint(pp *[]byte) uint32 {
-       v := uint32(0)
-       p := *pp
-       for shift := 0; ; shift += 7 {
-               v |= uint32(p[0]&0x7F) << uint(shift)
-               tmp7 := p
-               p = p[1:]
-               if tmp7[0]&0x80 == 0 {
-                       break
-               }
-       }
-
-       *pp = p
-       return v
-}
-
-func pciternext(it *Pciter) {
-       it.pc = it.nextpc
-       if it.done != 0 {
-               return
-       }
-       if -cap(it.p) >= -cap(it.d.P[len(it.d.P):]) {
-               it.done = 1
-               return
-       }
-
-       // value delta
-       v := getvarint(&it.p)
-
-       if v == 0 && it.start == 0 {
-               it.done = 1
-               return
-       }
-
-       it.start = 0
-       dv := int32(v>>1) ^ (int32(v<<31) >> 31)
-       it.value += dv
-
-       // pc delta
-       v = getvarint(&it.p)
-
-       it.nextpc = it.pc + v*it.pcscale
-}
-
-func pciterinit(ctxt *Link, it *Pciter, d *Pcdata) {
-       it.d = *d
-       it.p = it.d.P
-       it.pc = 0
-       it.nextpc = 0
-       it.value = -1
-       it.start = 1
-       it.done = 0
-       it.pcscale = uint32(ctxt.Arch.Minlc)
-       pciternext(it)
-}
index d9935b3d5139cfe144f0ed4e79074414f5b66790..5f856e0bf71e688a68dbc214af1a29527bf7e38c 100644 (file)
@@ -114,33 +114,23 @@ func Linknew(arch *LinkArch) *Link {
        return ctxt
 }
 
-func _lookup(ctxt *Link, symb string, v int, create bool) *LSym {
-       s := ctxt.Hash[SymVer{symb, v}]
-       if s != nil || !create {
+func Linklookup(ctxt *Link, name string, v int) *LSym {
+       s := ctxt.Hash[SymVer{name, v}]
+       if s != nil {
                return s
        }
 
        s = &LSym{
-               Name:    symb,
+               Name:    name,
                Type:    0,
                Version: int16(v),
                Value:   0,
                Size:    0,
        }
-       ctxt.Hash[SymVer{symb, v}] = s
-
+       ctxt.Hash[SymVer{name, v}] = s
        return s
 }
 
-func Linklookup(ctxt *Link, name string, v int) *LSym {
-       return _lookup(ctxt, name, v, true)
-}
-
-// read-only lookup
-func linkrlookup(ctxt *Link, name string, v int) *LSym {
-       return _lookup(ctxt, name, v, false)
-}
-
 func Linksymfmt(s *LSym) string {
        if s == nil {
                return "<nil>"