cmd/5g etc: merge simple case expressions onto fewer lines The c2go translation left a lot of case expressions on separate lines. Merge expressions onto single lines subject to these constraints: * Max 4 clauses, all literals or names * Don't move expressions with comments The change was created by running http://play.golang.org/p/yHajs72h-g: $ mergecase cmd/internal/{ld,gc,obj}/*.go cmd/internal/obj/*/*.go Passes toolstash -cmp. Change-Id: Iba41b390d302e5486e5dc6ba7599a92270676556 Reviewed-on: https://go-review.googlesource.com/7593 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
diff --git a/src/cmd/internal/gc/align.go b/src/cmd/internal/gc/align.go index 1171300..9025b1a 100644 --- a/src/cmd/internal/gc/align.go +++ b/src/cmd/internal/gc/align.go
@@ -151,10 +151,7 @@ et := int32(t.Etype) switch et { - case TFUNC, - TCHAN, - TMAP, - TSTRING: + case TFUNC, TCHAN, TMAP, TSTRING: break /* simtype == 0 during bootstrap */ @@ -170,25 +167,17 @@ Fatal("dowidth: unknown type: %v", Tconv(t, 0)) /* compiler-specific stuff */ - case TINT8, - TUINT8, - TBOOL: + case TINT8, TUINT8, TBOOL: // bool is int8 w = 1 - case TINT16, - TUINT16: + case TINT16, TUINT16: w = 2 - case TINT32, - TUINT32, - TFLOAT32: + case TINT32, TUINT32, TFLOAT32: w = 4 - case TINT64, - TUINT64, - TFLOAT64, - TCOMPLEX64: + case TINT64, TUINT64, TFLOAT64, TCOMPLEX64: w = 8 t.Align = uint8(Widthreg)
diff --git a/src/cmd/internal/gc/cgen.go b/src/cmd/internal/gc/cgen.go index 7566dda..f92a98f 100644 --- a/src/cmd/internal/gc/cgen.go +++ b/src/cmd/internal/gc/cgen.go
@@ -172,8 +172,7 @@ // can't do in walk because n->left->addable // changes if n->left is an escaping local variable. switch n.Op { - case OSPTR, - OLEN: + case OSPTR, OLEN: if Isslice(n.Left.Type) || Istype(n.Left.Type, TSTRING) { n.Addable = n.Left.Addable } @@ -665,9 +664,7 @@ } } - case OLSH, - ORSH, - OLROT: + case OLSH, ORSH, OLROT: Thearch.Cgen_shift(int(n.Op), n.Bounded, nl, nr, res) } @@ -1569,9 +1566,7 @@ Fixlargeoffset(a) return - case OCALLFUNC, - OCALLMETH, - OCALLINTER: + case OCALLFUNC, OCALLMETH, OCALLINTER: switch n.Op { case OCALLFUNC: cgen_call(n, 0)
diff --git a/src/cmd/internal/gc/closure.go b/src/cmd/internal/gc/closure.go index df89544..4b1e929 100644 --- a/src/cmd/internal/gc/closure.go +++ b/src/cmd/internal/gc/closure.go
@@ -486,8 +486,7 @@ func typecheckpartialcall(fn *Node, sym *Node) { switch fn.Op { - case ODOTINTER, - ODOTMETH: + case ODOTINTER, ODOTMETH: break default:
diff --git a/src/cmd/internal/gc/const.go b/src/cmd/internal/gc/const.go index ec84f65..6842c84 100644 --- a/src/cmd/internal/gc/const.go +++ b/src/cmd/internal/gc/const.go
@@ -96,8 +96,7 @@ return } - case OLSH, - ORSH: + case OLSH, ORSH: convlit1(&n.Left, t, explicit && isideal(n.Left.Type)) t = n.Left.Type if t != nil && t.Etype == TIDEAL && n.Val.Ctype != CTINT { @@ -199,25 +198,19 @@ } } - case CTSTR, - CTBOOL: + case CTSTR, CTBOOL: if et != int(n.Type.Etype) { goto bad } - case CTINT, - CTRUNE, - CTFLT, - CTCPLX: + case CTINT, CTRUNE, CTFLT, CTCPLX: ct := int(n.Val.Ctype) if Isint[et] { switch ct { default: goto bad - case CTCPLX, - CTFLT, - CTRUNE: + case CTCPLX, CTFLT, CTRUNE: n.Val = toint(n.Val) fallthrough @@ -230,9 +223,7 @@ default: goto bad - case CTCPLX, - CTINT, - CTRUNE: + case CTCPLX, CTINT, CTRUNE: n.Val = toflt(n.Val) fallthrough @@ -245,9 +236,7 @@ default: goto bad - case CTFLT, - CTINT, - CTRUNE: + case CTFLT, CTINT, CTRUNE: n.Val = tocplx(n.Val) case CTCPLX: @@ -281,8 +270,7 @@ func copyval(v Val) Val { switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: i := new(Mpint) mpmovefixfix(i, v.U.Xval) v.U.Xval = i @@ -304,8 +292,7 @@ func tocplx(v Val) Val { switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: c := new(Mpcplx) Mpmovefixflt(&c.Real, v.U.Xval) Mpmovecflt(&c.Imag, 0.0) @@ -325,8 +312,7 @@ func toflt(v Val) Val { switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: f := new(Mpflt) Mpmovefixflt(f, v.U.Xval) v.Ctype = CTFLT @@ -375,8 +361,7 @@ func doesoverflow(v Val, t *Type) bool { switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: if !Isint[t.Etype] { Fatal("overflow: %v integer constant", Tconv(t, 0)) } @@ -416,8 +401,7 @@ } switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: Yyerror("constant %v overflows %v", Bconv(v.U.Xval, 0), Tconv(t, 0)) case CTFLT: @@ -430,8 +414,7 @@ func tostr(v Val) Val { switch v.Ctype { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: if Mpcmpfixfix(v.U.Xval, Minintval[TINT]) < 0 || Mpcmpfixfix(v.U.Xval, Maxintval[TINT]) > 0 { Yyerror("overflow in int -> string") } @@ -710,8 +693,7 @@ // right must be unsigned. // left can be ideal. - case OLSH, - ORSH: + case OLSH, ORSH: defaultlit(&nr, Types[TUINT]) n.Right = nr @@ -1089,10 +1071,7 @@ case CTBOOL: n.Type = idealbool - case CTINT, - CTRUNE, - CTFLT, - CTCPLX: + case CTINT, CTRUNE, CTFLT, CTCPLX: n.Type = Types[TIDEAL] case CTNIL: @@ -1158,8 +1137,7 @@ } fallthrough - case OREAL, - OIMAG: + case OREAL, OIMAG: return CTFLT case OCOMPLEX: @@ -1182,8 +1160,7 @@ return CTBOOL // shifts (beware!). - case OLSH, - ORSH: + case OLSH, ORSH: return idealkind(n.Left) } } @@ -1351,10 +1328,7 @@ TPTR32: return true - case TIDEAL, - TINT64, - TUINT64, - TPTR64: + case TIDEAL, TINT64, TUINT64, TPTR64: if Mpcmpfixfix(n.Val.U.Xval, Minintval[TINT32]) < 0 || Mpcmpfixfix(n.Val.U.Xval, Maxintval[TINT32]) > 0 { break } @@ -1412,8 +1386,7 @@ case TUINT32: x = int64(uint32(x)) - case TINT64, - TUINT64: + case TINT64, TUINT64: break } @@ -1441,8 +1414,7 @@ default: Fatal("convconst ctype=%d %v", val.Ctype, Tconv(t, obj.FmtLong)) - case CTINT, - CTRUNE: + case CTINT, CTRUNE: i = Mpgetfix(val.U.Xval) case CTBOOL: @@ -1606,8 +1578,7 @@ return true } - case OLEN, - OCAP: + case OLEN, OCAP: l := n.Left if isgoconst(l) { return true
diff --git a/src/cmd/internal/gc/cplx.go b/src/cmd/internal/gc/cplx.go index 7c0a150..fe4c38c 100644 --- a/src/cmd/internal/gc/cplx.go +++ b/src/cmd/internal/gc/cplx.go
@@ -352,8 +352,7 @@ return } - case OREAL, - OIMAG: + case OREAL, OIMAG: nl := n.Left if nl.Addable == 0 { var tmp Node @@ -475,8 +474,7 @@ case OMINUS: complexminus(nl, res) - case OADD, - OSUB: + case OADD, OSUB: complexadd(int(n.Op), nl, nr, res) case OMUL:
diff --git a/src/cmd/internal/gc/esc.go b/src/cmd/internal/gc/esc.go index 10c6b5e..2215045 100644 --- a/src/cmd/internal/gc/esc.go +++ b/src/cmd/internal/gc/esc.go
@@ -234,8 +234,7 @@ // mktag returns the string representation for an escape analysis tag. func mktag(mask int) *string { switch mask & EscMask { - case EscNone, - EscReturn: + case EscNone, EscReturn: break default: @@ -538,8 +537,7 @@ // This assignment is a no-op for escape analysis, // it does not store any new pointers into b that were not already there. // However, without this special case b will escape, because we assign to OIND/ODOTPTR. - case OAS, - OASOP: + case OAS, OASOP: if (n.Left.Op == OIND || n.Left.Op == ODOTPTR) && n.Left.Left.Op == ONAME && // dst is ONAME dereference (n.Right.Op == OSLICE || n.Right.Op == OSLICE3 || n.Right.Op == OSLICESTR) && // src is slice operation (n.Right.Left.Op == OIND || n.Right.Left.Op == ODOTPTR) && n.Right.Left.Left.Op == ONAME && // slice is applied to ONAME dereference @@ -604,9 +602,7 @@ escassign(e, &e.theSink, ll.N) } - case OCALLMETH, - OCALLFUNC, - OCALLINTER: + case OCALLMETH, OCALLFUNC, OCALLINTER: esccall(e, n, up) // esccall already done on n->rlist->n. tie it's escretval to n->list @@ -653,8 +649,7 @@ } } - case OCONV, - OCONVNOP: + case OCONV, OCONVNOP: escassign(e, n, n.Left) case OCONVIFACE: @@ -780,8 +775,7 @@ // so that writing the address of one result // to another (or the same) result makes the // first result move to the heap. - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: n.Escloopdepth = 1 } } @@ -847,8 +841,7 @@ dst = &e.theSink // lose track of dereference - case OIND, - ODOTPTR: + case OIND, ODOTPTR: dst = &e.theSink // lose track of dereference // lose track of key and value @@ -889,9 +882,7 @@ // Flowing multiple returns to a single dst happens when // analyzing "go f(g())": here g() flows to sink (issue 4529). - case OCALLMETH, - OCALLFUNC, - OCALLINTER: + case OCALLMETH, OCALLFUNC, OCALLINTER: for ll := src.Escretval; ll != nil; ll = ll.Next { escflows(e, dst, ll.N) } @@ -1204,8 +1195,7 @@ // escaping to the global scope. func escflood(e *EscState, dst *Node) { switch dst.Op { - case ONAME, - OCLOSURE: + case ONAME, OCLOSURE: break default: @@ -1311,8 +1301,7 @@ escwalk(e, level, dst, src.Closure) } - case OPTRLIT, - OADDR: + case OPTRLIT, OADDR: if leaks { src.Esc = EscHeap addrescapes(src.Left) @@ -1372,9 +1361,7 @@ fallthrough // fall through - case ODOTPTR, - OINDEXMAP, - OIND: + case ODOTPTR, OINDEXMAP, OIND: newlevel := level if level > MinLevel {
diff --git a/src/cmd/internal/gc/fmt.go b/src/cmd/internal/gc/fmt.go index 392ba96..e5b9e56 100644 --- a/src/cmd/internal/gc/fmt.go +++ b/src/cmd/internal/gc/fmt.go
@@ -540,8 +540,7 @@ } switch t.Etype { - case TPTR32, - TPTR64: + case TPTR32, TPTR64: if fmtmode == FTypeId && (flag&obj.FmtShort != 0 /*untyped*/) { return fmt.Sprintf("*%v", Tconv(t.Type, obj.FmtShort)) } @@ -764,9 +763,7 @@ // Statements which may be rendered with a simplestmt as init. func stmtwithinit(op int) bool { switch op { - case OIF, - OFOR, - OSWITCH: + case OIF, OFOR, OSWITCH: return true } @@ -802,9 +799,7 @@ case ODCL: if fmtmode == FExp { switch n.Left.Class &^ PHEAP { - case PPARAM, - PPARAMOUT, - PAUTO: + case PPARAM, PPARAMOUT, PAUTO: f += fmt.Sprintf("var %v %v", Nconv(n.Left, 0), Tconv(n.Left.Type, 0)) goto ret } @@ -853,10 +848,7 @@ fallthrough // fallthrough - case OAS2DOTTYPE, - OAS2FUNC, - OAS2MAPR, - OAS2RECV: + case OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV: f += fmt.Sprintf("%v = %v", Hconv(n.List, obj.FmtComma), Hconv(n.Rlist, obj.FmtComma)) case ORETURN: @@ -919,8 +911,7 @@ f += fmt.Sprintf("for %v = range %v { %v }", Hconv(n.List, obj.FmtComma), Nconv(n.Right, 0), Hconv(n.Nbody, 0)) - case OSELECT, - OSWITCH: + case OSELECT, OSWITCH: if fmtmode == FErr { f += fmt.Sprintf("%v statement", Oconv(int(n.Op), 0)) break @@ -936,8 +927,7 @@ f += fmt.Sprintf(" { %v }", Hconv(n.List, 0)) - case OCASE, - OXCASE: + case OCASE, OXCASE: if n.List != nil { f += fmt.Sprintf("case %v: %v", Hconv(n.List, obj.FmtComma), Hconv(n.Nbody, 0)) } else { @@ -1158,8 +1148,7 @@ fallthrough //fallthrough - case OPACK, - ONONAME: + case OPACK, ONONAME: return Sconv(n.Sym, 0) case OTYPE: @@ -1270,8 +1259,7 @@ // fallthrough - case OARRAYLIT, - OMAPLIT: + case OARRAYLIT, OMAPLIT: if fmtmode == FErr { return fmt.Sprintf("%v literal", Tconv(n.Type, 0)) } @@ -1313,8 +1301,7 @@ f += fmt.Sprintf(".%v", Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte)) return f - case ODOTTYPE, - ODOTTYPE2: + case ODOTTYPE, ODOTTYPE2: var f string f += exprfmt(n.Left, nprec) if n.Right != nil { @@ -1336,8 +1323,7 @@ f += fmt.Sprintf("[%v]", Nconv(n.Right, 0)) return f - case OCOPY, - OCOMPLEX: + case OCOPY, OCOMPLEX: return fmt.Sprintf("%v(%v, %v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0), Nconv(n.Right, 0)) case OCONV, @@ -1377,10 +1363,7 @@ } return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma)) - case OCALL, - OCALLFUNC, - OCALLINTER, - OCALLMETH: + case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH: var f string f += exprfmt(n.Left, nprec) if n.Isddd { @@ -1390,9 +1373,7 @@ f += fmt.Sprintf("(%v)", Hconv(n.List, obj.FmtComma)) return f - case OMAKEMAP, - OMAKECHAN, - OMAKESLICE: + case OMAKEMAP, OMAKECHAN, OMAKESLICE: if n.List != nil { // pre-typecheck return fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma)) } @@ -1460,8 +1441,7 @@ return f - case OCMPSTR, - OCMPIFACE: + case OCMPSTR, OCMPIFACE: var f string f += exprfmt(n.Left, nprec) f += fmt.Sprintf(" %v ", Oconv(int(n.Etype), obj.FmtSharp)) @@ -1533,15 +1513,13 @@ default: fmt.Fprintf(&buf, "%v%v", Oconv(int(n.Op), 0), Jconv(n, 0)) - case OREGISTER, - OINDREG: + case OREGISTER, OINDREG: fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), obj.Rconv(int(n.Val.U.Reg)), Jconv(n, 0)) case OLITERAL: fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Vconv(&n.Val, 0), Jconv(n, 0)) - case ONAME, - ONONAME: + case ONAME, ONONAME: if n.Sym != nil { fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Sconv(n.Sym, 0), Jconv(n, 0)) } else { @@ -1689,8 +1667,7 @@ _ = r var str string switch fmtmode { - case FErr, - FExp: + case FErr, FExp: str = nodefmt(n, flag) case FDbg:
diff --git a/src/cmd/internal/gc/gen.go b/src/cmd/internal/gc/gen.go index 1a7f76f..ef6377b 100644 --- a/src/cmd/internal/gc/gen.go +++ b/src/cmd/internal/gc/gen.go
@@ -57,8 +57,7 @@ // so the param already has a valid xoffset. // expression to refer to stack copy - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: n.Stackparam = Nod(OPARAM, n, nil) n.Stackparam.Type = n.Type @@ -93,8 +92,7 @@ Curfn = oldfn } - case OIND, - ODOTPTR: + case OIND, ODOTPTR: break // ODOTPTR has already been introduced, @@ -102,8 +100,7 @@ // In &x[0], if x is a slice, then x does not // escape--the pointer inside x does, but that // is always a heap pointer anyway. - case ODOT, - OINDEX: + case ODOT, OINDEX: if !Isslice(n.Left.Type) { addrescapes(n.Left) } @@ -338,23 +335,18 @@ z.Addable = 1 switch Simtype[n.Type.Etype] { - case TCOMPLEX64, - TCOMPLEX128: + case TCOMPLEX64, TCOMPLEX128: z.Val.U.Cval = new(Mpcplx) Mpmovecflt(&z.Val.U.Cval.Real, 0.0) Mpmovecflt(&z.Val.U.Cval.Imag, 0.0) - case TFLOAT32, - TFLOAT64: + case TFLOAT32, TFLOAT64: var zero Mpflt Mpmovecflt(&zero, 0.0) z.Val.Ctype = CTFLT z.Val.U.Fval = &zero - case TPTR32, - TPTR64, - TCHAN, - TMAP: + case TPTR32, TPTR64, TCHAN, TMAP: z.Val.Ctype = CTNIL case TBOOL: @@ -833,9 +825,7 @@ if n.Defn != nil { switch n.Defn.Op { // so stmtlabel can find the label - case OFOR, - OSWITCH, - OSELECT: + case OFOR, OSWITCH, OSELECT: n.Defn.Sym = lab.Sym } } @@ -1009,8 +999,7 @@ case ODEFER: cgen_proc(n, 2) - case ORETURN, - ORETJMP: + case ORETURN, ORETJMP: cgen_ret(n) case OCHECKNIL: @@ -1175,8 +1164,7 @@ goto no } - case TSTRING, - TINTER: + case TSTRING, TINTER: break }
diff --git a/src/cmd/internal/gc/gsubr.go b/src/cmd/internal/gc/gsubr.go index 4a9f895..357bca1 100644 --- a/src/cmd/internal/gc/gsubr.go +++ b/src/cmd/internal/gc/gsubr.go
@@ -250,9 +250,7 @@ func Isfat(t *Type) bool { if t != nil { switch t.Etype { - case TSTRUCT, - TARRAY, - TSTRING, + case TSTRUCT, TARRAY, TSTRING, TINTER: // maybe remove later return true } @@ -384,8 +382,7 @@ case PAUTO: a.Name = obj.NAME_AUTO - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: a.Name = obj.NAME_PARAM case PFUNC: @@ -409,8 +406,7 @@ a.Type = obj.TYPE_FCONST a.Val = mpgetflt(n.Val.U.Fval) - case CTINT, - CTRUNE: + case CTINT, CTRUNE: a.Sym = nil a.Type = obj.TYPE_CONST a.Offset = Mpgetfix(n.Val.U.Xval)
diff --git a/src/cmd/internal/gc/init.go b/src/cmd/internal/gc/init.go index 8aaed8c..b3a6a00 100644 --- a/src/cmd/internal/gc/init.go +++ b/src/cmd/internal/gc/init.go
@@ -54,10 +54,7 @@ // are there any interesting init statements for l := n; l != nil; l = l.Next { switch l.N.Op { - case ODCLFUNC, - ODCLCONST, - ODCLTYPE, - OEMPTY: + case ODCLFUNC, ODCLCONST, ODCLTYPE, OEMPTY: break case OAS:
diff --git a/src/cmd/internal/gc/inl.go b/src/cmd/internal/gc/inl.go index cdd709e..5e5cb6d 100644 --- a/src/cmd/internal/gc/inl.go +++ b/src/cmd/internal/gc/inl.go
@@ -200,10 +200,7 @@ } // Things that are too hairy, irrespective of the budget - case OCALL, - OCALLINTER, - OPANIC, - ORECOVER: + case OCALL, OCALLINTER, OPANIC, ORECOVER: if Debug['l'] < 4 { return true } @@ -244,9 +241,7 @@ } switch n.Op { - case ONAME, - OTYPE, - OLITERAL: + case ONAME, OTYPE, OLITERAL: return n } @@ -338,11 +333,9 @@ switch n.Op { // inhibit inlining of their argument - case ODEFER, - OPROC: + case ODEFER, OPROC: switch n.Left.Op { - case OCALLFUNC, - OCALLMETH: + case OCALLFUNC, OCALLMETH: n.Left.Etype = n.Op } fallthrough @@ -453,8 +446,7 @@ // transmogrify this node itself unless inhibited by the // switch at the top of this function. switch n.Op { - case OCALLFUNC, - OCALLMETH: + case OCALLFUNC, OCALLMETH: if n.Etype == OPROC || n.Etype == ODEFER { return } @@ -647,10 +639,7 @@ if n.List != nil && n.List.Next == nil { switch n.List.N.Op { - case OCALL, - OCALLFUNC, - OCALLINTER, - OCALLMETH: + case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH: if n.List.N.Left.Type.Outtuple > 1 { multiret = n.List.N.Left.Type.Outtuple - 1 } @@ -920,8 +909,7 @@ } return n - case OLITERAL, - OTYPE: + case OLITERAL, OTYPE: return n // Since we don't handle bodies with closures, this return is guaranteed to belong to the current inlined function. @@ -950,8 +938,7 @@ // dump("Return after substitution", m); return m - case OGOTO, - OLABEL: + case OGOTO, OLABEL: m := Nod(OXXX, nil, nil) *m = *n m.Ninit = nil
diff --git a/src/cmd/internal/gc/lex.go b/src/cmd/internal/gc/lex.go index 0d715cf..370722c 100644 --- a/src/cmd/internal/gc/lex.go +++ b/src/cmd/internal/gc/lex.go
@@ -1277,8 +1277,7 @@ * * i said it was clumsy. */ - case '(', - '[': + case '(', '[': if loophack != 0 || _yylex_lstk != nil { h = new(Loophack) if h == nil { @@ -1295,8 +1294,7 @@ goto lx - case ')', - ']': + case ')', ']': if _yylex_lstk != nil { h = _yylex_lstk loophack = h.v @@ -1382,10 +1380,7 @@ case LIGNORE: goto l0 - case LFOR, - LIF, - LSWITCH, - LSELECT: + case LFOR, LIF, LSWITCH, LSELECT: loophack = 1 // see comment about loophack above }
diff --git a/src/cmd/internal/gc/mparith1.go b/src/cmd/internal/gc/mparith1.go index b3435e5..51d888a 100644 --- a/src/cmd/internal/gc/mparith1.go +++ b/src/cmd/internal/gc/mparith1.go
@@ -340,8 +340,7 @@ c := s[0] s = s[1:] switch c { - case '-', - '+': + case '-', '+': break case '0': @@ -411,9 +410,7 @@ f = 1 fallthrough - case ' ', - '\t', - '+': + case ' ', '\t', '+': continue case '.': @@ -442,13 +439,11 @@ } continue - case 'P', - 'p': + case 'P', 'p': eb = 1 fallthrough - case 'E', - 'e': + case 'E', 'e': ex = 0 ef = 0 for {
diff --git a/src/cmd/internal/gc/order.go b/src/cmd/internal/gc/order.go index 4092b32..44aa8a7 100644 --- a/src/cmd/internal/gc/order.go +++ b/src/cmd/internal/gc/order.go
@@ -105,8 +105,7 @@ // and then returns tmp. func ordercheapexpr(n *Node, order *Order) *Node { switch n.Op { - case ONAME, - OLITERAL: + case ONAME, OLITERAL: return n } @@ -122,8 +121,7 @@ // The intended use is to apply to x when rewriting x += y into x = x + y. func ordersafeexpr(n *Node, order *Order) *Node { switch n.Op { - case ONAME, - OLITERAL: + case ONAME, OLITERAL: return n case ODOT: @@ -138,8 +136,7 @@ typecheck(&a, Erv) return a - case ODOTPTR, - OIND: + case ODOTPTR, OIND: l := ordercheapexpr(n.Left, order) if l == n.Left { return n @@ -151,8 +148,7 @@ typecheck(&a, Erv) return a - case OINDEX, - OINDEXMAP: + case OINDEX, OINDEXMAP: var l *Node if Isfixedarray(n.Left.Type) { l = ordersafeexpr(n.Left, order) @@ -315,9 +311,7 @@ default: return false - case OCALLFUNC, - OCALLMETH, - OCALLINTER: + case OCALLFUNC, OCALLMETH, OCALLINTER: break } @@ -409,10 +403,7 @@ order.out = list(order.out, a) } - case OAS2, - OAS2DOTTYPE, - OAS2MAPR, - OAS2FUNC: + case OAS2, OAS2DOTTYPE, OAS2MAPR, OAS2FUNC: var post *NodeList var m *Node var a *Node @@ -470,9 +461,7 @@ orderexprlist(n.List, order) orderexprlist(n.Rlist, order) switch n.Op { - case OAS, - OAS2, - OAS2DOTTYPE: + case OAS, OAS2, OAS2DOTTYPE: ordermapassign(n, order) default: @@ -579,8 +568,7 @@ cleantemp(t, order) // Special: does not save n onto out. - case OBLOCK, - OEMPTY: + case OBLOCK, OEMPTY: orderstmtlist(n.List, order) // Special: n->left is not an expression; save as is. @@ -597,9 +585,7 @@ order.out = list(order.out, n) // Special: handle call arguments. - case OCALLFUNC, - OCALLINTER, - OCALLMETH: + case OCALLFUNC, OCALLINTER, OCALLMETH: t := marktemp(order) ordercall(n, order) @@ -607,8 +593,7 @@ cleantemp(t, order) // Special: order arguments to inner call but not call itself. - case ODEFER, - OPROC: + case ODEFER, OPROC: t := marktemp(order) switch n.Left.Op { @@ -713,8 +698,7 @@ // chan, string, slice, array ranges use value multiple times. // make copy. // fall through - case TCHAN, - TSTRING: + case TCHAN, TSTRING: r := n.Right if r.Type.Etype == TSTRING && r.Type != Types[TSTRING] { @@ -785,8 +769,7 @@ // the ODCL nodes to declare x and y. We want to delay that // declaration (and possible allocation) until inside the case body. // Delete the ODCL nodes here and recreate them inside the body below. - case OSELRECV, - OSELRECV2: + case OSELRECV, OSELRECV2: if r.Colas != 0 { t = r.Ninit if t != nil && t.N.Op == ODCL && t.N.Left == r.Left { @@ -1052,8 +1035,7 @@ orderaddrtemp(&n.Left, order) } - case OANDAND, - OOROR: + case OANDAND, OOROR: mark := marktemp(order) orderexpr(&n.Left, order) @@ -1089,8 +1071,7 @@ n.Alloc = ordertemp(Types[TUINT8], order, false) // walk will fill in correct type } - case OARRAYLIT, - OCALLPART: + case OARRAYLIT, OCALLPART: orderexpr(&n.Left, order) orderexpr(&n.Right, order) orderexprlist(n.List, order) @@ -1121,8 +1102,7 @@ orderexpr(&n.Left, order) n = ordercopyexpr(n, n.Type, order, 1) - case OEQ, - ONE: + case OEQ, ONE: orderexpr(&n.Left, order) orderexpr(&n.Right, order) t := n.Left.Type
diff --git a/src/cmd/internal/gc/pgen.go b/src/cmd/internal/gc/pgen.go index de106ad..e18f2d5 100644 --- a/src/cmd/internal/gc/pgen.go +++ b/src/cmd/internal/gc/pgen.go
@@ -93,9 +93,7 @@ } switch n.Class { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: Thearch.Gins(as, nil, n) } } @@ -473,9 +471,7 @@ continue } switch n.Class { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: Nodconst(&nod1, Types[TUINTPTR], l.N.Type.Width) p = Thearch.Gins(obj.ATYPE, l.N, &nod1) p.From.Gotype = Linksym(ngotype(l.N))
diff --git a/src/cmd/internal/gc/plive.go b/src/cmd/internal/gc/plive.go index 4cbeca0..f322e84 100644 --- a/src/cmd/internal/gc/plive.go +++ b/src/cmd/internal/gc/plive.go
@@ -243,8 +243,7 @@ result = append(result, ll.N) } - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: ll.N.Opt = int32(len(result)) result = append(result, ll.N) } @@ -616,9 +615,7 @@ from := &prog.From if from.Node != nil && from.Sym != nil && ((from.Node).(*Node)).Curfn == Curfn { switch ((from.Node).(*Node)).Class &^ PHEAP { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: pos, ok := from.Node.(*Node).Opt.(int32) // index in vars if !ok { goto Next @@ -647,9 +644,7 @@ to := &prog.To if to.Node != nil && to.Sym != nil && ((to.Node).(*Node)).Curfn == Curfn { switch ((to.Node).(*Node)).Class &^ PHEAP { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: pos, ok := to.Node.(*Node).Opt.(int32) // index in vars if !ok { return @@ -1011,8 +1006,7 @@ xoffset = node.Xoffset + stkptrsize twobitwalktype1(node.Type, &xoffset, locals) - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: xoffset = node.Xoffset twobitwalktype1(node.Type, &xoffset, args) } @@ -1202,8 +1196,7 @@ // Check whether n is marked live in args/locals. func islive(n *Node, args Bvec, locals Bvec) bool { switch n.Class { - case PPARAM, - PPARAMOUT: + case PPARAM, PPARAMOUT: for i := 0; int64(i) < n.Type.Width/int64(Widthptr)*obj.BitsPerPointer; i++ { if bvget(args, int32(n.Xoffset/int64(Widthptr)*obj.BitsPerPointer+int64(i))) != 0 { return true
diff --git a/src/cmd/internal/gc/racewalk.go b/src/cmd/internal/gc/racewalk.go index 2b3fc30..bbbd167 100644 --- a/src/cmd/internal/gc/racewalk.go +++ b/src/cmd/internal/gc/racewalk.go
@@ -137,15 +137,13 @@ default: Fatal("racewalk: unknown node type %v", Oconv(int(n.Op), 0)) - case OAS, - OAS2FUNC: + case OAS, OAS2FUNC: racewalknode(&n.Left, init, 1, 0) racewalknode(&n.Right, init, 0, 0) goto ret // can't matter - case OCFUNC, - OVARKILL: + case OCFUNC, OVARKILL: goto ret case OBLOCK: @@ -158,9 +156,7 @@ // x, y := f() becomes BLOCK{CALL f, AS x [SP+0], AS y [SP+n]} // We don't want to instrument between the statements because it will // smash the results. - case OCALLFUNC, - OCALLMETH, - OCALLINTER: + case OCALLFUNC, OCALLMETH, OCALLINTER: racewalknode(&n.List.N, &n.List.N.Ninit, 0, 0) var fini *NodeList @@ -248,9 +244,7 @@ callinstr(&n, init, wr, skip) goto ret - case OSPTR, - OLEN, - OCAP: + case OSPTR, OLEN, OCAP: racewalknode(&n.Left, init, 0, 0) if Istype(n.Left.Type, TMAP) { n1 := Nod(OCONVNOP, n.Left, nil) @@ -284,8 +278,7 @@ racewalknode(&n.Right, init, wr, 0) goto ret - case OANDAND, - OOROR: + case OANDAND, OOROR: racewalknode(&n.Left, init, wr, 0) // walk has ensured the node has moved to a location where @@ -308,8 +301,7 @@ racewalknode(&n.Left, init, wr, 0) goto ret - case ODIV, - OMOD: + case ODIV, OMOD: racewalknode(&n.Left, init, wr, 0) racewalknode(&n.Right, init, wr, 0) goto ret @@ -333,10 +325,7 @@ // Seems to only lead to double instrumentation. //racewalknode(&n->left, init, 0, 0); - case OSLICE, - OSLICEARR, - OSLICE3, - OSLICE3ARR: + case OSLICE, OSLICEARR, OSLICE3, OSLICE3ARR: goto ret case OADDR: @@ -399,8 +388,7 @@ goto ret // impossible nodes: only appear in backend. - case ORROTC, - OEXTEND: + case ORROTC, OEXTEND: Yyerror("racewalk: %v cannot exist now", Oconv(int(n.Op), 0)) goto ret @@ -559,8 +547,7 @@ } // Turn T(v).Field into v.Field - case ODOT, - OXDOT: + case ODOT, OXDOT: if n.Left.Op == OCONVNOP { n.Left = n.Left.Left } @@ -621,10 +608,7 @@ func hascallspred(n *Node, c interface{}) { switch n.Op { - case OCALL, - OCALLFUNC, - OCALLMETH, - OCALLINTER: + case OCALL, OCALLFUNC, OCALLMETH, OCALLINTER: (*c.(*int))++ } } @@ -640,8 +624,7 @@ switch n.Op { // There may be multiple refs to this node; // introduce OCONVNOP to hold init list. - case ONAME, - OLITERAL: + case ONAME, OLITERAL: n = Nod(OCONVNOP, n, nil) n.Type = n.Left.Type
diff --git a/src/cmd/internal/gc/reflect.go b/src/cmd/internal/gc/reflect.go index 35984f1..bd5be0f 100644 --- a/src/cmd/internal/gc/reflect.go +++ b/src/cmd/internal/gc/reflect.go
@@ -1148,8 +1148,7 @@ ot = duint16(s, ot, uint16(mapbucket(t).Width)) ot = duint8(s, ot, uint8(bool2int(isreflexive(t.Down)))) - case TPTR32, - TPTR64: + case TPTR32, TPTR64: if t.Type.Etype == TANY { // ../../runtime/type.go:/UnsafePointerType ot = dcommontype(s, ot, t) @@ -1213,9 +1212,7 @@ // we want be able to find. if t.Sym == nil { switch t.Etype { - case TARRAY, - TCHAN, - TMAP: + case TARRAY, TCHAN, TMAP: slink := typelinksym(t) dsymptr(slink, 0, s, 0) ggloblsym(slink, int32(Widthptr), int8(dupok|obj.RODATA))
diff --git a/src/cmd/internal/gc/reg.go b/src/cmd/internal/gc/reg.go index 5546960..66982ef 100644 --- a/src/cmd/internal/gc/reg.go +++ b/src/cmd/internal/gc/reg.go
@@ -390,8 +390,7 @@ } switch et { - case 0, - TFUNC: + case 0, TFUNC: return zbits } @@ -678,8 +677,7 @@ return Thearch.RtoB(i) } - case TFLOAT32, - TFLOAT64: + case TFLOAT32, TFLOAT64: i := Thearch.BtoF(^b) if i != 0 && r.cost > 0 { r.regno = int16(i)
diff --git a/src/cmd/internal/gc/select.go b/src/cmd/internal/gc/select.go index e3c9294..3a28ea3 100644 --- a/src/cmd/internal/gc/select.go +++ b/src/cmd/internal/gc/select.go
@@ -129,8 +129,7 @@ case OSEND: ch = n.Left - case OSELRECV, - OSELRECV2: + case OSELRECV, OSELRECV2: ch = n.Right.Left if n.Op == OSELRECV || n.Ntest == nil { if n.Left == nil { @@ -185,8 +184,7 @@ n.Right = Nod(OADDR, n.Right, nil) typecheck(&n.Right, Erv) - case OSELRECV, - OSELRECV2: + case OSELRECV, OSELRECV2: if n.Op == OSELRECV2 && n.Ntest == nil { n.Op = OSELRECV }
diff --git a/src/cmd/internal/gc/sinit.go b/src/cmd/internal/gc/sinit.go index 2dec757..f716736 100644 --- a/src/cmd/internal/gc/sinit.go +++ b/src/cmd/internal/gc/sinit.go
@@ -42,8 +42,7 @@ return } switch n.Class { - case PEXTERN, - PFUNC: + case PEXTERN, PFUNC: break default: @@ -172,10 +171,7 @@ *out = list(*out, n.Defn) } - case OAS2FUNC, - OAS2MAPR, - OAS2DOTTYPE, - OAS2RECV: + case OAS2FUNC, OAS2MAPR, OAS2DOTTYPE, OAS2RECV: if n.Defn.Initorder != InitNotStarted { break } @@ -244,9 +240,7 @@ for ; l != nil; l = l.Next { n = l.N switch n.Op { - case ODCLFUNC, - ODCLCONST, - ODCLTYPE: + case ODCLFUNC, ODCLCONST, ODCLTYPE: continue } @@ -333,9 +327,7 @@ break // copy pointer - case OARRAYLIT, - OSTRUCTLIT, - OMAPLIT: + case OARRAYLIT, OSTRUCTLIT, OMAPLIT: gdata(l, Nod(OADDR, r.Nname, nil), int(l.Type.Width)) return true @@ -430,9 +422,7 @@ break // Init pointer. - case OARRAYLIT, - OMAPLIT, - OSTRUCTLIT: + case OARRAYLIT, OMAPLIT, OSTRUCTLIT: a := staticname(r.Left.Type, 1) r.Nname = a @@ -1222,9 +1212,7 @@ // not a special composit literal assignment return false - case OSTRUCTLIT, - OARRAYLIT, - OMAPLIT: + case OSTRUCTLIT, OARRAYLIT, OMAPLIT: if vmatch1(n.Left, n.Right) { // not a special composit literal assignment return false @@ -1377,8 +1365,7 @@ case CTBOOL: return n.Val.U.Bval == 0 - case CTINT, - CTRUNE: + case CTINT, CTRUNE: return mpcmpfixc(n.Val.U.Xval, 0) == 0 case CTFLT: @@ -1522,8 +1509,7 @@ TFLOAT64: gdata(&nam, nr, int(nr.Type.Width)) - case TCOMPLEX64, - TCOMPLEX128: + case TCOMPLEX64, TCOMPLEX128: gdatacomplex(&nam, nr.Val.U.Cval) case TSTRING:
diff --git a/src/cmd/internal/gc/subr.go b/src/cmd/internal/gc/subr.go index 32486c7..8d199a2 100644 --- a/src/cmd/internal/gc/subr.go +++ b/src/cmd/internal/gc/subr.go
@@ -257,10 +257,7 @@ lno := lineno if n != nil { switch n.Op { - case ONAME, - OTYPE, - OPACK, - OLITERAL: + case ONAME, OTYPE, OPACK, OLITERAL: break default: @@ -435,8 +432,7 @@ switch t.Etype { // will be defined later. - case TANY, - TFORW: + case TANY, TFORW: *bad = t return -1 @@ -459,8 +455,7 @@ TUNSAFEPTR: return AMEM - case TFUNC, - TMAP: + case TFUNC, TMAP: if bad != nil { *bad = t } @@ -741,8 +736,7 @@ default: Yyerror("array bound must be an integer expression") - case CTINT, - CTRUNE: + case CTINT, CTRUNE: bound = Mpgetfix(b.Val.U.Xval) if bound < 0 { Yyerror("array bound must be non negative") @@ -791,9 +785,7 @@ fallthrough // fall through - case ONAME, - OLITERAL, - OTYPE: + case ONAME, OLITERAL, OTYPE: m = n } @@ -875,8 +867,7 @@ return true } switch t.Etype { - case TNIL, - TIDEAL: + case TNIL, TIDEAL: return true } @@ -985,8 +976,7 @@ return true } - case TINT, - TINT32: + case TINT, TINT32: if (t1 == Types[runetype.Etype] || t1 == runetype) && (t2 == Types[runetype.Etype] || t2 == runetype) { return true } @@ -1004,8 +994,7 @@ l.t2 = t2 switch t1.Etype { - case TINTER, - TSTRUCT: + case TINTER, TSTRUCT: t1 = t1.Type t2 = t2.Type for ; t1 != nil && t2 != nil; t1, t2 = t1.Down, t2.Down { @@ -1430,9 +1419,7 @@ return false } switch Simtype[t.Etype] { - case TINT64, - TUINT64, - TPTR64: + case TINT64, TUINT64, TPTR64: return true } @@ -1447,22 +1434,16 @@ e2 := int(Simtype[t2.Etype]) switch e1 { - case TINT8, - TUINT8: + case TINT8, TUINT8: return e2 == TINT8 || e2 == TUINT8 - case TINT16, - TUINT16: + case TINT16, TUINT16: return e2 == TINT16 || e2 == TUINT16 - case TINT32, - TUINT32, - TPTR32: + case TINT32, TUINT32, TPTR32: return e2 == TINT32 || e2 == TUINT32 || e2 == TPTR32 - case TINT64, - TUINT64, - TPTR64: + case TINT64, TUINT64, TPTR64: return e2 == TINT64 || e2 == TUINT64 || e2 == TPTR64 case TFLOAT32: @@ -1501,10 +1482,7 @@ nt = shallow(t) nt.Copyany = 1 - case TPTR32, - TPTR64, - TCHAN, - TARRAY: + case TPTR32, TPTR64, TCHAN, TARRAY: nt = shallow(t) nt.Type = deep(t.Type) @@ -1642,25 +1620,19 @@ } switch n.Op { - case OREGISTER, - OLITERAL, - ONAME: + case OREGISTER, OLITERAL, ONAME: ul = 1 if n.Class == PPARAMREF || (n.Class&PHEAP != 0) { ul++ } goto out - case OCALL, - OCALLFUNC, - OCALLMETH, - OCALLINTER: + case OCALL, OCALLFUNC, OCALLMETH, OCALLINTER: ul = UINF goto out // hard with race detector - case OANDAND, - OOROR: + case OANDAND, OOROR: if flag_race != 0 { ul = UINF goto out @@ -1726,9 +1698,7 @@ default: goto bad - case TSTRUCT, - TINTER, - TFUNC: + case TSTRUCT, TINTER, TFUNC: break } @@ -1903,8 +1873,7 @@ } switch n.Op { - case ONAME, - OLITERAL: + case ONAME, OLITERAL: return n case ODOT: @@ -1919,8 +1888,7 @@ walkexpr(&r, init) return r - case ODOTPTR, - OIND: + case ODOTPTR, OIND: l := safeexpr(n.Left, init) if l == n.Left { return n @@ -1931,8 +1899,7 @@ walkexpr(&a, init) return a - case OINDEX, - OINDEXMAP: + case OINDEX, OINDEXMAP: l := safeexpr(n.Left, init) r := safeexpr(n.Right, init) if l == n.Left && r == n.Right { @@ -1968,8 +1935,7 @@ */ func cheapexpr(n *Node, init **NodeList) *Node { switch n.Op { - case ONAME, - OLITERAL: + case ONAME, OLITERAL: return n } @@ -3472,8 +3438,7 @@ switch n.Op { // There may be multiple refs to this node; // introduce OCONVNOP to hold init list. - case ONAME, - OLITERAL: + case ONAME, OLITERAL: n = Nod(OCONVNOP, n, nil) n.Type = n.Left.Type
diff --git a/src/cmd/internal/gc/typecheck.go b/src/cmd/internal/gc/typecheck.go index 2db5bd6..93d2ea6 100644 --- a/src/cmd/internal/gc/typecheck.go +++ b/src/cmd/internal/gc/typecheck.go
@@ -146,10 +146,7 @@ // But re-typecheck ONAME/OTYPE/OLITERAL/OPACK node in case context has changed. if n.Typecheck == 1 { switch n.Op { - case ONAME, - OTYPE, - OLITERAL, - OPACK: + case ONAME, OTYPE, OLITERAL, OPACK: break default: @@ -265,10 +262,7 @@ return } switch consttype(n) { - case CTINT, - CTRUNE, - CTFLT, - CTCPLX: + case CTINT, CTRUNE, CTFLT, CTCPLX: defaultlit(np, Types[TINT]) } @@ -385,8 +379,7 @@ l := typecheck(&n.Left, Erv) var v Val switch consttype(l) { - case CTINT, - CTRUNE: + case CTINT, CTRUNE: v = l.Val case CTFLT: @@ -790,10 +783,7 @@ n.Type = t break OpSwitch - case OCOM, - OMINUS, - ONOT, - OPLUS: + case OCOM, OMINUS, ONOT, OPLUS: ok |= Erv l := typecheck(&n.Left, Erv|top&Eiota) t := l.Type @@ -939,8 +929,7 @@ } switch n.Op { - case ODOTINTER, - ODOTMETH: + case ODOTINTER, ODOTMETH: if top&Ecall != 0 { ok |= Ecall } else { @@ -1020,8 +1009,7 @@ n.Type = nil return - case TSTRING, - TARRAY: + case TSTRING, TARRAY: indexlit(&n.Right) if t.Etype == TSTRING { n.Type = Types[TUINT8] @@ -1390,10 +1378,7 @@ n.Type = getoutargx(l.Type) break OpSwitch - case OCAP, - OLEN, - OREAL, - OIMAG: + case OCAP, OLEN, OREAL, OIMAG: ok |= Erv if onearg(n, "%v", Oconv(int(n.Op), 0)) < 0 { n.Type = nil @@ -1419,8 +1404,7 @@ goto badcall1 } - case OREAL, - OIMAG: + case OREAL, OIMAG: if !Iscomplex[t.Etype] { goto badcall1 } @@ -1935,8 +1919,7 @@ n.Type = Ptrto(t) break OpSwitch - case OPRINT, - OPRINTN: + case OPRINT, OPRINTN: ok |= Etop typechecklist(n.List, Erv|Eindir) // Eindir: address does not escape for args := n.List; args != nil; args = args.Next { @@ -2801,8 +2784,7 @@ default: // unknown, bool, nil b = 23 - case CTINT, - CTRUNE: + case CTINT, CTRUNE: b = uint32(Mpgetfix(n.Val.U.Xval)) case CTFLT: @@ -2919,17 +2901,12 @@ func iscomptype(t *Type) bool { switch t.Etype { - case TARRAY, - TSTRUCT, - TMAP: + case TARRAY, TSTRUCT, TMAP: return true - case TPTR32, - TPTR64: + case TPTR32, TPTR64: switch t.Type.Etype { - case TARRAY, - TSTRUCT, - TMAP: + case TARRAY, TSTRUCT, TMAP: return true } } @@ -3225,10 +3202,7 @@ fallthrough // fall through - case OIND, - ODOTPTR, - OCLOSUREVAR, - OPARAM: + case OIND, ODOTPTR, OCLOSUREVAR, OPARAM: return true case ODOT: @@ -3298,12 +3272,10 @@ } switch l.Op { - case ONAME, - OCLOSUREVAR: + case ONAME, OCLOSUREVAR: return l == r - case ODOT, - ODOTPTR: + case ODOT, ODOTPTR: return l.Right != nil && r.Right != nil && l.Right.Sym == r.Right.Sym && samesafeexpr(l.Left, r.Left) case OIND: @@ -3364,9 +3336,7 @@ switch n.Right.Op { // For x = x[0:y], x can be updated in place, without touching pointer. // TODO(rsc): Reenable once it is actually updated in place without touching the pointer. - case OSLICE, - OSLICE3, - OSLICESTR: + case OSLICE, OSLICE3, OSLICESTR: if false && samesafeexpr(n.Left, n.Right.Left) && (n.Right.Right.Left == nil || iszero(n.Right.Right.Left)) { n.Right.Reslice = true } @@ -3439,9 +3409,7 @@ goto out } switch r.Op { - case OCALLMETH, - OCALLINTER, - OCALLFUNC: + case OCALLMETH, OCALLINTER, OCALLFUNC: if r.Type.Etype != TSTRUCT || r.Type.Funarg == 0 { break } @@ -3766,8 +3734,7 @@ Fatal("typecheckdef %v", Oconv(int(n.Op), 0)) // not really syms - case OGOTO, - OLABEL: + case OGOTO, OLABEL: break case OLITERAL: @@ -3901,10 +3868,7 @@ func checkmake(t *Type, arg string, n *Node) int { if n.Op == OLITERAL { switch n.Val.Ctype { - case CTINT, - CTRUNE, - CTFLT, - CTCPLX: + case CTINT, CTRUNE, CTFLT, CTCPLX: n.Val = toint(n.Val) if mpcmpfixc(n.Val.U.Xval, 0) < 0 { Yyerror("negative %s argument in make(%v)", arg, Tconv(t, 0)) @@ -4054,9 +4018,7 @@ case OIF: return isterminating(n.Nbody, 0) && isterminating(n.Nelse, 0) - case OSWITCH, - OTYPESW, - OSELECT: + case OSWITCH, OTYPESW, OSELECT: if n.Hasbreak { return false }
diff --git a/src/cmd/internal/gc/unsafe.go b/src/cmd/internal/gc/unsafe.go index 6faed49..7bd35f8 100644 --- a/src/cmd/internal/gc/unsafe.go +++ b/src/cmd/internal/gc/unsafe.go
@@ -62,8 +62,7 @@ base := r.Left typecheck(&r, Erv) switch r.Op { - case ODOT, - ODOTPTR: + case ODOT, ODOTPTR: break case OCALLPART:
diff --git a/src/cmd/internal/gc/walk.go b/src/cmd/internal/gc/walk.go index a2da8e7..422be57 100644 --- a/src/cmd/internal/gc/walk.go +++ b/src/cmd/internal/gc/walk.go
@@ -232,8 +232,7 @@ case ODEFER: Hasdefer = 1 switch n.Left.Op { - case OPRINT, - OPRINTN: + case OPRINT, OPRINTN: walkprintfunc(&n.Left, &n.Ninit) case OCOPY: @@ -265,8 +264,7 @@ case OPROC: switch n.Left.Op { - case OPRINT, - OPRINTN: + case OPRINT, OPRINTN: walkprintfunc(&n.Left, &n.Ninit) case OCOPY: @@ -466,13 +464,11 @@ walkexpr(&n.Right, init) goto ret - case OSPTR, - OITAB: + case OSPTR, OITAB: walkexpr(&n.Left, init) goto ret - case OLEN, - OCAP: + case OLEN, OCAP: walkexpr(&n.Left, init) // replace len(*[10]int) with 10. @@ -490,8 +486,7 @@ goto ret - case OLSH, - ORSH: + case OLSH, ORSH: walkexpr(&n.Left, init) walkexpr(&n.Right, init) t := n.Left.Type @@ -521,15 +516,13 @@ walkexpr(&n.Right, init) goto ret - case OOR, - OXOR: + case OOR, OXOR: walkexpr(&n.Left, init) walkexpr(&n.Right, init) walkrotate(&n) goto ret - case OEQ, - ONE: + case OEQ, ONE: walkexpr(&n.Left, init) walkexpr(&n.Right, init) @@ -545,8 +538,7 @@ safemode = old_safemode goto ret - case OANDAND, - OOROR: + case OANDAND, OOROR: walkexpr(&n.Left, init) // cannot put side effects from n.Right on init, @@ -558,8 +550,7 @@ addinit(&n.Right, ll) goto ret - case OPRINT, - OPRINTN: + case OPRINT, OPRINTN: walkexprlist(n.List, init) n = walkprint(n, init) goto ret @@ -576,8 +567,7 @@ n.Addable = 1 goto ret - case OCLOSUREVAR, - OCFUNC: + case OCLOSUREVAR, OCFUNC: n.Addable = 1 goto ret @@ -784,12 +774,10 @@ p := "" if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing. switch Simsimtype(t.Down) { - case TINT32, - TUINT32: + case TINT32, TUINT32: p = "mapaccess2_fast32" - case TINT64, - TUINT64: + case TINT64, TUINT64: p = "mapaccess2_fast64" case TSTRING: @@ -1066,8 +1054,7 @@ walkexpr(&n, init) goto ret - case OCONV, - OCONVNOP: + case OCONV, OCONVNOP: if Thearch.Thechar == '5' { if Isfloat[n.Left.Type.Etype] { if n.Type.Etype == TINT64 { @@ -1111,8 +1098,7 @@ walkmul(&n, init) goto ret - case ODIV, - OMOD: + case ODIV, OMOD: walkexpr(&n.Left, init) walkexpr(&n.Right, init) @@ -1141,8 +1127,7 @@ * on 32-bit architectures. */ switch n.Op { - case OMOD, - ODIV: + case OMOD, ODIV: if Widthreg >= 8 || (et != TUINT64 && et != TINT64) { goto ret } @@ -1229,12 +1214,10 @@ p := "" if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing. switch Simsimtype(t.Down) { - case TINT32, - TUINT32: + case TINT32, TUINT32: p = "mapaccess1_fast32" - case TINT64, - TUINT64: + case TINT64, TUINT64: p = "mapaccess1_fast64" case TSTRING: @@ -1277,8 +1260,7 @@ fallthrough // fallthrough - case OSLICEARR, - OSLICESTR: + case OSLICEARR, OSLICESTR: if n.Right == nil { // already processed goto ret } @@ -1299,8 +1281,7 @@ n = sliceany(n, init) // chops n.Right, sets n.List goto ret - case OSLICE3, - OSLICE3ARR: + case OSLICE3, OSLICE3ARR: if n.Right == nil { // already processed goto ret } @@ -1606,10 +1587,7 @@ n = r goto ret - case OARRAYLIT, - OMAPLIT, - OSTRUCTLIT, - OPTRLIT: + case OARRAYLIT, OMAPLIT, OSTRUCTLIT, OPTRLIT: var_ := temp(n.Type) anylit(0, n, var_, init) n = var_ @@ -2125,9 +2103,7 @@ case ONAME: switch n.Class { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: return true } } @@ -2207,10 +2183,7 @@ // small compared to the cost of the allocation.) if r.Reslice { switch r.Op { - case OSLICE, - OSLICE3, - OSLICESTR, - OAPPEND: + case OSLICE, OSLICE3, OSLICESTR, OAPPEND: break default: @@ -2449,16 +2422,14 @@ case ONAME: break - case OINDEX, - OINDEXMAP: + case OINDEX, OINDEXMAP: reorder3save(&l.Left, all, list, &early) reorder3save(&l.Right, all, list, &early) if l.Op == OINDEXMAP { list.N = convas(list.N, &mapinit) } - case OIND, - ODOTPTR: + case OIND, ODOTPTR: reorder3save(&l.Left, all, list, &early) } @@ -2544,9 +2515,7 @@ varwrite = 1 continue - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: if n.Addrtaken { varwrite = 1 continue @@ -2596,9 +2565,7 @@ case ONAME: switch n.Class { - case PAUTO, - PPARAM, - PPARAMOUT: + case PAUTO, PPARAM, PPARAMOUT: if !n.Addrtaken { return true } @@ -2679,9 +2646,7 @@ switch l.Op { case ONAME: switch l.Class { - case PPARAM, - PPARAMREF, - PAUTO: + case PPARAM, PPARAMREF, PAUTO: break // assignment to non-stack variable @@ -3622,8 +3587,7 @@ case ONAME: return a == b - case ODOT, - ODOTPTR: + case ODOT, ODOTPTR: ar = a.Right br = b.Right if ar.Op != ONAME || br.Op != ONAME || ar.Sym != br.Sym { @@ -3845,9 +3809,7 @@ return // n1 = nl * magic >> w (HMUL) - case TUINT8, - TUINT16, - TUINT32: + case TUINT8, TUINT16, TUINT32: nc := Nod(OXXX, nil, nil) Nodconst(nc, nl.Type, int64(m.Um)) @@ -3861,15 +3823,13 @@ default: return - case TUINT8, - TUINT16: + case TUINT8, TUINT16: twide = Types[TUINT32] case TUINT32: twide = Types[TUINT64] - case TINT8, - TINT16: + case TINT8, TINT16: twide = Types[TINT32] case TINT32: @@ -3894,9 +3854,7 @@ } // n1 = nl * magic >> w - case TINT8, - TINT16, - TINT32: + case TINT8, TINT16, TINT32: nc := Nod(OXXX, nil, nil) Nodconst(nc, nl.Type, m.Sm) @@ -4111,8 +4069,7 @@ default: Fatal("usefield %v", Oconv(int(n.Op), 0)) - case ODOT, - ODOTPTR: + case ODOT, ODOTPTR: break } @@ -4220,8 +4177,7 @@ break // Discardable as long as we know it's not division by zero. - case ODIV, - OMOD: + case ODIV, OMOD: if Isconst(n.Right, CTINT) && mpcmpfixc(n.Right.Val.U.Xval, 0) != 0 { break } @@ -4231,8 +4187,7 @@ return false // Discardable as long as we know it won't fail because of a bad size. - case OMAKECHAN, - OMAKEMAP: + case OMAKECHAN, OMAKEMAP: if Isconst(n.Left, CTINT) && mpcmpfixc(n.Left.Val.U.Xval, 0) == 0 { break }