]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: convert Debug* Link fields into bools
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Mar 2017 22:01:20 +0000 (15:01 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Mar 2017 22:08:41 +0000 (22:08 +0000)
Change-Id: I9ac274dbfe887675a7820d2f8f87b5887b1c9b0e
Reviewed-on: https://go-review.googlesource.com/38383
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
14 files changed:
src/cmd/asm/main.go
src/cmd/compile/internal/gc/main.go
src/cmd/internal/obj/arm/asm5.go
src/cmd/internal/obj/arm/obj5.go
src/cmd/internal/obj/arm64/asm7.go
src/cmd/internal/obj/arm64/obj7.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/mips/asm0.go
src/cmd/internal/obj/mips/obj0.go
src/cmd/internal/obj/objfile.go
src/cmd/internal/obj/plist.go
src/cmd/internal/obj/ppc64/asm9.go
src/cmd/internal/obj/ppc64/obj9.go
src/cmd/internal/obj/s390x/objz.go

index 0bea3c5f20c7e883e15618ef9034b09c16fb6e93..627cce33803016abdd8b0018fb7de69e316a8b2b 100644 (file)
@@ -35,7 +35,7 @@ func main() {
 
        ctxt := obj.Linknew(architecture.LinkArch)
        if *flags.PrintOut {
-               ctxt.Debugasm = 1
+               ctxt.Debugasm = true
        }
        ctxt.Flag_dynlink = *flags.Dynlink
        ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
index 975bc579ba79eefb91343872e2bb0858ae12d7a0..a99067cb150e11149c59cea9f6573a79f20e275b 100644 (file)
@@ -32,10 +32,12 @@ var (
 
 var (
        Debug_append   int
+       Debug_asm      bool
        Debug_closure  int
        debug_dclstack int
        Debug_panic    int
        Debug_slice    int
+       Debug_vlog     bool
        Debug_wb       int
        Debug_pctab    string
 )
@@ -174,7 +176,7 @@ func Main(archInit func(*Arch)) {
        obj.Flagfn1("I", "add `directory` to import search path", addidir)
        obj.Flagcount("K", "debug missing line numbers", &Debug['K'])
        obj.Flagcount("N", "disable optimizations", &Debug['N'])
-       obj.Flagcount("S", "print assembly listing", &Debug['S'])
+       flag.BoolVar(&Debug_asm, "S", false, "print assembly listing")
        obj.Flagfn0("V", "print compiler version", doversion)
        obj.Flagcount("W", "debug parse tree after type checking", &Debug['W'])
        flag.StringVar(&asmhdr, "asmhdr", "", "write assembly header to `file`")
@@ -203,7 +205,7 @@ func Main(archInit func(*Arch)) {
        obj.Flagcount("s", "warn about composite literals that can be simplified", &Debug['s'])
        flag.StringVar(&pathPrefix, "trimpath", "", "remove `prefix` from recorded source file paths")
        flag.BoolVar(&safemode, "u", false, "reject unsafe code")
-       obj.Flagcount("v", "increase debug verbosity", &Debug['v'])
+       flag.BoolVar(&Debug_vlog, "v", false, "increase debug verbosity")
        obj.Flagcount("w", "debug type checking", &Debug['w'])
        flag.BoolVar(&use_writebarrier, "wb", true, "enable write barrier")
        var flag_shared bool
@@ -226,8 +228,8 @@ func Main(archInit func(*Arch)) {
        Ctxt.Flag_dynlink = flag_dynlink
        Ctxt.Flag_optimize = Debug['N'] == 0
 
-       Ctxt.Debugasm = int32(Debug['S'])
-       Ctxt.Debugvlog = int32(Debug['v'])
+       Ctxt.Debugasm = Debug_asm
+       Ctxt.Debugvlog = Debug_vlog
 
        if flag.NArg() < 1 {
                usage()
index 89665b15e424f2c4d34652748d3bae28eb9675a1..42c139dcd66ca68ef2ab3e974e20d654f47797e6 100644 (file)
@@ -646,7 +646,7 @@ func span5(ctxt *obj.Link, cursym *obj.LSym) {
        var opc int32
        var out [6 + 3]uint32
        for {
-               if ctxt.Debugvlog != 0 {
+               if ctxt.Debugvlog {
                        ctxt.Logf("%5.2f span1\n", obj.Cputime())
                }
                bflag = 0
index 52a17e9fd890bc039688026d53468478e3a27cae..dfc31010fc4e1e834d2592de0393938b495c66c8 100644 (file)
@@ -355,7 +355,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
                        }
 
                        if autosize == 0 && cursym.Text.Mark&LEAF == 0 {
-                               if ctxt.Debugvlog != 0 {
+                               if ctxt.Debugvlog {
                                        ctxt.Logf("save suppressed in: %s\n", cursym.Name)
                                }
 
@@ -549,7 +549,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
                        if cursym.Text.From3.Offset&obj.NOSPLIT != 0 {
                                ctxt.Diag("cannot divide in NOSPLIT function")
                        }
-                       if ctxt.Debugdivmod != 0 {
+                       if ctxt.Debugdivmod {
                                break
                        }
                        if p.From.Type != obj.TYPE_REG {
index c5fc023a6d9b74c8f8973c9ea791e958eb160d97..bf105a24ff7ed51187585df8cfea4ef84c7f6bf7 100644 (file)
@@ -587,7 +587,7 @@ func span7(ctxt *obj.Link, cursym *obj.LSym) {
         * around jmps to fix. this is rare.
         */
        for bflag != 0 {
-               if ctxt.Debugvlog != 0 {
+               if ctxt.Debugvlog {
                        ctxt.Logf("%5.2f span1\n", obj.Cputime())
                }
                bflag = 0
@@ -687,7 +687,7 @@ func checkpool(ctxt *obj.Link, p *obj.Prog, skip int) {
 func flushpool(ctxt *obj.Link, p *obj.Prog, skip int) {
        if ctxt.Blitrl != nil {
                if skip != 0 {
-                       if ctxt.Debugvlog != 0 && skip == 1 {
+                       if ctxt.Debugvlog && skip == 1 {
                                fmt.Printf("note: flush literal pool at %#x: len=%d ref=%x\n", uint64(p.Pc+4), pool.size, pool.start)
                        }
                        q := ctxt.NewProg()
index f68964ab496e6141e100159901045724d40c2d42..7b0a08a1daf1fbe6e7eb92342ddad0784f9d9b95 100644 (file)
@@ -555,7 +555,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
                        }
                        p.To.Offset = int64(ctxt.Autosize) - 8
                        if ctxt.Autosize == 0 && !(cursym.Text.Mark&LEAF != 0) {
-                               if ctxt.Debugvlog != 0 {
+                               if ctxt.Debugvlog {
                                        ctxt.Logf("save suppressed in: %s\n", cursym.Text.From.Sym.Name)
                                }
                                cursym.Text.Mark |= LEAF
index e55af81c989c0d810bb073592077862a3f3dfe32..adc1a7495660223e37b65d890b1fe2606cfbfb40 100644 (file)
@@ -719,9 +719,9 @@ type Pcdata struct {
 type Link struct {
        Headtype      HeadType
        Arch          *LinkArch
-       Debugasm      int32
-       Debugvlog     int32
-       Debugdivmod   int32
+       Debugasm      bool
+       Debugvlog     bool
+       Debugdivmod   bool
        Debugpcln     string
        Flag_shared   bool
        Flag_dynlink  bool
index eee37a93368cd3f49db3c1106a18e89d14ac837c..897073e95e190f60372acdaad5857e32e9b1a3ad 100644 (file)
@@ -417,7 +417,7 @@ func span0(ctxt *obj.Link, cursym *obj.LSym) {
        var otxt int64
        var q *obj.Prog
        for bflag != 0 {
-               if ctxt.Debugvlog != 0 {
+               if ctxt.Debugvlog {
                        ctxt.Logf("%5.2f span1\n", obj.Cputime())
                }
                bflag = 0
index 097b834e49410b6ea42be1aa35f86d0d0a2e7c67..fe1ce9c02787bb31bad26952508774dd6c472ba4 100644 (file)
@@ -168,7 +168,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
         * expand RET
         * expand BECOME pseudo
         */
-       if ctxt.Debugvlog != 0 {
+       if ctxt.Debugvlog {
                ctxt.Logf("%5.2f noops\n", obj.Cputime())
        }
 
@@ -340,7 +340,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
                                q.Spadj = +autosize
                        } else if cursym.Text.Mark&LEAF == 0 {
                                if cursym.Text.From3.Offset&obj.NOSPLIT != 0 {
-                                       if ctxt.Debugvlog != 0 {
+                                       if ctxt.Debugvlog {
                                                ctxt.Logf("save suppressed in: %s\n", cursym.Name)
                                        }
 
index 9a208b20b1edd5f968155061f8e4fc7d5f0a4d00..150c46752c56e8cc9068a9e8bb469cc0c8a4841b 100644 (file)
@@ -380,7 +380,7 @@ func (w *objWriter) writeSymDebug(s *LSym) {
 
 func (w *objWriter) writeSym(s *LSym) {
        ctxt := w.ctxt
-       if ctxt.Debugasm != 0 {
+       if ctxt.Debugasm {
                w.writeSymDebug(s)
        }
 
index 9baf1775e513366410e6be5221bb28343fc7d4ba..6b2ae8bb9e7b52565cb2c4d6c2cfe27d932fbff7 100644 (file)
@@ -15,7 +15,7 @@ type Plist struct {
 }
 
 func Flushplist(ctxt *Link, plist *Plist) {
-       flushplist(ctxt, plist, ctxt.Debugasm == 0)
+       flushplist(ctxt, plist, !ctxt.Debugasm)
 }
 func FlushplistNoFree(ctxt *Link, plist *Plist) {
        flushplist(ctxt, plist, false)
@@ -28,7 +28,7 @@ func flushplist(ctxt *Link, plist *Plist, freeProgs bool) {
 
        var plink *Prog
        for p := plist.Firstpc; p != nil; p = plink {
-               if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 {
+               if ctxt.Debugasm && ctxt.Debugvlog {
                        fmt.Printf("obj: %v\n", p)
                }
                plink = p.Link
index 0fdce94b7c2a22904c2b5d43592701aa75ce014f..41a0ffbf1772ff86e177030b57b11b89f86f9870 100644 (file)
@@ -597,7 +597,7 @@ func span9(ctxt *obj.Link, cursym *obj.LSym) {
        var otxt int64
        var q *obj.Prog
        for bflag != 0 {
-               if ctxt.Debugvlog != 0 {
+               if ctxt.Debugvlog {
                        ctxt.Logf("%5.2f span1\n", obj.Cputime())
                }
                bflag = 0
index 7ad754b77e37356f8f78544c1835c8efa65cb93d..5639ec989dad7ecc53867a201a0c1a1e24e05652 100644 (file)
@@ -274,7 +274,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
         * expand RET
         * expand BECOME pseudo
         */
-       if ctxt.Debugvlog != 0 {
+       if ctxt.Debugvlog {
                ctxt.Logf("%5.2f noops\n", obj.Cputime())
        }
 
index a404d7916dade7bd34173e1244f713a6f4fe13b2..6cb3718cdf4d7c18f1b6c2dc375432ce46bb646f 100644 (file)
@@ -240,7 +240,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
         * strip NOPs
         * expand RET
         */
-       if ctxt.Debugvlog != 0 {
+       if ctxt.Debugvlog {
                ctxt.Logf("%5.2f noops\n", obj.Cputime())
        }