cmd/compile/internal/gc: change flags to bool where possible
Some of the Debug[x] flags are actually boolean too, but not all, so
they need to be handled separately.
While here, change some obj.Flagstr and obj.Flagint64 calls to
directly use flag.StringVar and flag.Int64Var instead.
Change-Id: Iccedf6fed4328240ee2257f57fe6d66688f237c4
Reviewed-on: https://go-review.googlesource.com/22052
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 3e5f516..78bad8d 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -594,8 +594,7 @@
// for a struct containing a reflect.Value, which itself has
// an unexported field of type unsafe.Pointer.
old_safemode := safemode
-
- safemode = 0
+ safemode = false
n = walkcompare(n, init)
safemode = old_safemode
@@ -1938,7 +1937,7 @@
on = substArgTypes(on, n.Type) // any-1
} else if Isint[et] {
if et == TUINT64 {
- if (t.Sym.Pkg == Runtimepkg || compiling_runtime != 0) && t.Sym.Name == "hex" {
+ if (t.Sym.Pkg == Runtimepkg || compiling_runtime) && t.Sym.Name == "hex" {
on = syslook("printhex")
} else {
on = syslook("printuint")
@@ -2041,7 +2040,7 @@
// Do we need a write barrier for the assignment l = r?
func needwritebarrier(l *Node, r *Node) bool {
- if use_writebarrier == 0 {
+ if !use_writebarrier {
return false
}
@@ -2550,7 +2549,7 @@
}
// generate allocation & copying code
- if compiling_runtime != 0 {
+ if compiling_runtime {
Yyerror("%v escapes to heap, not allowed in runtime.", v)
}
if prealloc[v] == nil {