Skip to content

Commit b53088a

Browse files
committed
Revert "go/printer: forbid empty line before first comment in block"
This reverts commit 08f19bb. Reason for revert: The changed transformation takes effect on a larger set of code snippets than expected. For example, this: func foo() { // Comment bar() } becomes: func foo() { // Comment bar() } This is an unintended consequence. Change-Id: Ifca88d6267dab8a8170791f7205124712bf8ace8 Reviewed-on: https://go-review.googlesource.com/81335 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Joe Tsai <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 2065685 commit b53088a

File tree

30 files changed

+26
-293
lines changed

30 files changed

+26
-293
lines changed

misc/cgo/test/buildid_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func testBuildID(t *testing.T) {
3939
}
4040

4141
for len(d) > 0 {
42+
4243
// ELF standards differ as to the sizes in
4344
// note sections. Both the GNU linker and
4445
// gold always generate 32-bit sizes, so that

src/cmd/compile/internal/ssa/gen/rulegen.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ func extract(val string) (op string, typ string, auxint string, aux string, args
659659
// It returns the op and unparsed strings for typ, auxint, and aux restrictions and for all args.
660660
// oparch is the architecture that op is located in, or "" for generic.
661661
func parseValue(val string, arch arch, loc string) (op opData, oparch string, typ string, auxint string, aux string, args []string) {
662+
662663
// Resolve the op.
663664
var s string
664665
s, typ, auxint, aux, args = extract(val)

src/cmd/internal/obj/ppc64/asm9.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,6 +2474,7 @@ func (c *ctxt9) asmout(p *obj.Prog, o *Optab, out []uint32) {
24742474
d := c.vregoff(p.GetFrom3())
24752475
var a int
24762476
switch p.As {
2477+
24772478
// These opcodes expect a mask operand that has to be converted into the
24782479
// appropriate operand. The way these were defined, not all valid masks are possible.
24792480
// Left here for compatibility in case they were used or generated.

src/cmd/internal/obj/x86/asm6.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,7 @@ func span6(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
20512051
c = 0
20522052
for p := s.Func.Text; p != nil; p = p.Link {
20532053
if ctxt.Headtype == objabi.Hnacl && p.Isize > 0 {
2054+
20542055
// pad everything to avoid crossing 32-byte boundary
20552056
if c>>5 != (c+int32(p.Isize)-1)>>5 {
20562057
c = naclpad(ctxt, s, c, -c&31)

src/cmd/link/internal/ld/data.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,7 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s *sym.Symbol, va uint6
18591859
// Only break at outermost syms.
18601860

18611861
if ctxt.Arch.InFamily(sys.PPC64) && s.Outer == nil && ctxt.IsELF && ctxt.LinkMode == LinkExternal && va-sect.Vaddr+funcsize+maxSizeTrampolinesPPC64(s, isTramp) > 0x1c00000 {
1862+
18621863
// Set the length for the previous text section
18631864
sect.Length = va - sect.Vaddr
18641865

src/cmd/link/internal/ppc64/asm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ func archrelocaddr(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, val *int64) bool
523523

524524
// resolve direct jump relocation r in s, and add trampoline if necessary
525525
func trampoline(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol) {
526+
526527
// Trampolines are created if the branch offset is too large and the linker cannot insert a call stub to handle it.
527528
// For internal linking, trampolines are always created for long calls.
528529
// For external linking, the linker can insert a call stub to handle a long call, but depends on having the TOC address in
@@ -541,6 +542,7 @@ func trampoline(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol) {
541542
if (ctxt.LinkMode == ld.LinkExternal && s.Sect != r.Sym.Sect) || (ctxt.LinkMode == ld.LinkInternal && int64(int32(t<<6)>>6) != t) || (*ld.FlagDebugTramp > 1 && s.File != r.Sym.File) {
542543
var tramp *sym.Symbol
543544
for i := 0; ; i++ {
545+
544546
// Using r.Add as part of the name is significant in functions like duffzero where the call
545547
// target is at some offset within the function. Calls to duff+8 and duff+256 must appear as
546548
// distinct trampolines.

src/encoding/base32/base32.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) {
290290
dlen := 8
291291

292292
for j := 0; j < 8; {
293+
293294
// We have reached the end and are missing padding
294295
if len(src) == 0 && enc.padChar != NoPadding {
295296
return n, false, CorruptInputError(olen - len(src) - j)

src/go/doc/testdata/blank.0.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ TYPES
4848
H uint32
4949

5050
A uint8
51-
5251
// contains filtered or unexported fields
5352
}
5453

src/go/doc/testdata/blank.2.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ TYPES
4848
H uint32
4949

5050
A uint8
51-
5251
// contains filtered or unexported fields
5352
}
5453

src/go/doc/testdata/testing.0.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ TYPES
4242
// B is a type passed to Benchmark functions to manage benchmark ...
4343
type B struct {
4444
N int
45-
4645
// contains filtered or unexported fields
4746
}
4847

0 commit comments

Comments
 (0)