Excluding vendor and testdata.
CL 384268 already reformatted most, but these slipped past.
The struct in the doc comment in debug/dwarf/type.go
was fixed up by hand to indent the first and last lines as well.
For #51082.
Change-Id: Iad020f83aafd671ff58238fe491907e85923d0c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/407137
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
zip *Reader
zipr io.ReaderAt
headerOffset int64 // includes overall ZIP archive baseOffset
- zip64 bool // zip64 extended information extra field presence
+ zip64 bool // zip64 extended information extra field presence
}
// OpenReader will open the Zip file specified by name and return a ReadCloser.
}
// A JumpTableStmt is used to implement switches. Its semantics are:
-// tmp := jt.Idx
-// if tmp == Cases[0] goto Targets[0]
-// if tmp == Cases[1] goto Targets[1]
-// ...
-// if tmp == Cases[n] goto Targets[n]
+//
+// tmp := jt.Idx
+// if tmp == Cases[0] goto Targets[0]
+// if tmp == Cases[1] goto Targets[1]
+// ...
+// if tmp == Cases[n] goto Targets[n]
+//
// Note that a JumpTableStmt is more like a multiway-goto than
// a multiway-if. In particular, the case bodies are just
// labels to jump to, not not full Nodes lists.
// AssertableTo reports whether a value of type V can be asserted to have type T.
//
// The behavior of AssertableTo is undefined in two cases:
-// - if V is a generalized interface; i.e., an interface that may only be used
-// as a type constraint in Go code
-// - if T is an uninstantiated generic type
+// - if V is a generalized interface; i.e., an interface that may only be used
+// as a type constraint in Go code
+// - if T is an uninstantiated generic type
func AssertableTo(V *Interface, T Type) bool {
// Checker.newAssertableTo suppresses errors for invalid types, so we need special
// handling here.
//
// For detailed usage information:
//
-// go tool pprof -h
+// go tool pprof -h
//
// For an example, see https://blog.golang.org/profiling-go-programs.
package main
func (x *cbc) BlockSize() int { return BlockSize }
// cryptBlocksChain invokes the cipher message identifying encrypt or decrypt.
+//
//go:noescape
func cryptBlocksChain(src, dst *byte, length int, key *uint32, iv *byte, enc int, nr int)
// A StructField represents a field in a struct, union, or C++ class type.
//
-// Bit Fields
+// # Bit Fields
//
// The BitSize, BitOffset, and DataBitOffset fields describe the bit
// size and offset of data members declared as bit fields in C/C++
// Here is an example of C/C++ bit field use, along with what to
// expect in terms of DWARF bit offset info. Consider this code:
//
-// struct S {
-// int q;
-// int j:5;
-// int k:6;
-// int m:5;
-// int n:8;
-// } s;
+// struct S {
+// int q;
+// int j:5;
+// int k:6;
+// int m:5;
+// int n:8;
+// } s;
//
// For the code above, one would expect to see the following for
// DW_AT_bit_offset values (using GCC 8):
//
-// Little | Big
-// Endian | Endian
-// |
-// "j": 27 | 0
-// "k": 21 | 5
-// "m": 16 | 11
-// "n": 8 | 16
+// Little | Big
+// Endian | Endian
+// |
+// "j": 27 | 0
+// "k": 21 | 5
+// "m": 16 | 11
+// "n": 8 | 16
//
// Note that in the above the offsets are purely with respect to the
// containing storage unit for j/k/m/n -- these values won't vary based
// If the compiler emits DW_AT_data_bit_offset, the expected values
// would be:
//
-// "j": 32
-// "k": 37
-// "m": 43
-// "n": 48
+// "j": 32
+// "k": 37
+// "m": 43
+// "n": 48
//
// Here the value 32 for "j" reflects the fact that the bit field is
// preceded by other data members (recall that DW_AT_data_bit_offset
// non-zero bit size and bit offset, so this information is also
// captured for base types, but it is worth noting that it is not
// possible to trigger this behavior using mainstream languages.
-//
type StructField struct {
Name string
Type Type
// another_struct {quix short unsigned int@0; xyz [-1]int@4; x unsigned int@4 : 1@31; array [40]long long int@8}
//
// Note the "-1" for the xyz field, which should be zero.
-//
func TestBitFieldZeroArrayIssue50685(t *testing.T) {
f := "testdata/bitfields.elf4"
testTypedefs(t, elfData(t, f), "elf", bitfieldTests)
// symbols for a given primary symbol are placed following it in the
// array, e.g.
//
-// ...
-// k+0: regular sym k
-// k+1: 1st aux symbol for k
-// k+2: 2nd aux symbol for k
-// k+3: regular sym k+3
-// k+4: 1st aux symbol for k+3
-// k+5: regular sym k+5
-// k+6: regular sym k+6
+// ...
+// k+0: regular sym k
+// k+1: 1st aux symbol for k
+// k+2: 2nd aux symbol for k
+// k+3: regular sym k+3
+// k+4: 1st aux symbol for k+3
+// k+5: regular sym k+5
+// k+6: regular sym k+6
//
// The PE format allows for several possible aux symbol formats. For
// more info see:
//
-// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records
+// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records
//
// At the moment this package only provides APIs for looking at
// aux symbols of format 5 (associated with section definition symbols).
// file by reading from it. The reader must be positioned at the
// start of the file before calling this function. The hdr result
// is the string before the export data, either "$$" or "$$B".
-//
func FindExportData(r *bufio.Reader) (hdr string, size int, err error) {
// Read first line to make sure this is an object file.
line, err := r.ReadSlice('\n')
// Second, the name is frequently interpreted as meaning that you have
// to wait longer (to be patient) for the diff, meaning that it is a slower algorithm,
// when in fact the algorithm is faster than the standard one.
-//
func Diff(oldName string, old []byte, newName string, new []byte) []byte {
if bytes.Equal(old, new) {
return nil
}
func (mr *multiReader) WriteTo(w Writer) (sum int64, err error) {
- return mr.writeToWithBuffer(w, make([]byte, 1024 * 32))
+ return mr.writeToWithBuffer(w, make([]byte, 1024*32))
}
func (mr *multiReader) writeToWithBuffer(w Writer, buf []byte) (sum int64, err error) {
// f is a function that takes x as an argument, doesn't modify it, sets v to the
// result, and returns v. It is the function signature of unbound methods like
//
-// func (v *big.Int) m(x *big.Int) *big.Int
+// func (v *big.Int) m(x *big.Int) *big.Int
//
// v and x are two random Int values. v is randomized even if it will be
// overwritten to test for improper buffer reuse.
// to the result, and returns v. It is the function signature of unbound methods
// like
//
-// func (v *big.Int) m(x, y *big.Int) *big.Int
+// func (v *big.Int) m(x, y *big.Int) *big.Int
//
// v, x and y are random Int values. v is randomized even if it will be
// overwritten to test for improper buffer reuse.
//
// TODO(iant): We could consider changing this to os.ErrDeadlineExceeded
// in the future, if we make
-// errors.Is(os.ErrDeadlineExceeded, context.DeadlineExceeded)
+//
+// errors.Is(os.ErrDeadlineExceeded, context.DeadlineExceeded)
+//
// return true.
var errTimeout error = &timeoutError{}
// aggressively. This limit will be respected even if GOGC=off (or,
// if SetGCPercent(-1) is executed).
//
-//
// The input limit is provided as bytes, and includes all memory
// mapped, managed, and not released by the Go runtime. Notably, it
// does not account for space used by the Go binary and memory
// More specifically, the following expression accurately reflects
// the value the runtime attempts to maintain as the limit:
//
-// runtime.MemStats.Sys - runtime.MemStats.HeapReleased
+// runtime.MemStats.Sys - runtime.MemStats.HeapReleased
//
// or in terms of the runtime/metrics package:
//
-// /memory/classes/total:bytes - /memory/classes/heap/released:bytes
+// /memory/classes/total:bytes - /memory/classes/heap/released:bytes
//
// A zero limit or a limit that's lower than the amount of memory
// used by the Go runtime may cause the garbage collector to run
//
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
+//
//go:nosplit
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
sysStat.add(int64(n))
//
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
+//
//go:nosplit
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
sysStat.add(-int64(n))
// If this returns false, the caller must NOT become an idle mark worker.
//
// nosplit because it may be called without a P.
+//
//go:nosplit
func (c *gcControllerState) addIdleMarkWorker() bool {
for {
// useful for a quick check before an expensive operation.
//
// nosplit because it may be called without a P.
+//
//go:nosplit
func (c *gcControllerState) needIdleMarkWorker() bool {
p := c.idleMarkWorkers.Load()
//
// This function throws if the system call returns with anything other than the
// expected values.
+//
//go:nosplit
func runPerThreadSyscall() {
gp := getg()
//
// s must match the following regular expression:
//
-// ^[0-9]+(([KMGT]i)?B)?$
+// ^[0-9]+(([KMGT]i)?B)?$
//
// In other words, an integer byte count with an optional unit
// suffix. Acceptable suffixes include one of
// license that can be found in the LICENSE file.
//go:build linux && s390x
-// +build linux
-// +build s390x
+// +build linux,s390x
package runtime
//
// For example, to look for a particular string in a sorted, random-access
// list of strings:
-// i, found := sort.Find(x.Len(), func(i int) int {
-// return strings.Compare(target, x.At(i))
-// })
-// if found {
-// fmt.Printf("found %s at entry %d\n", target, i)
-// } else {
-// fmt.Printf("%s not found, would insert at %d", target, i)
-// }
+//
+// i, found := sort.Find(x.Len(), func(i int) int {
+// return strings.Compare(target, x.At(i))
+// })
+// if found {
+// fmt.Printf("found %s at entry %d\n", target, i)
+// } else {
+// fmt.Printf("%s not found, would insert at %d", target, i)
+// }
func Find(n int, cmp func(int) int) (i int, found bool) {
// The invariants here are similar to the ones in Search.
// Define cmp(-1) > 0 and cmp(n) <= 0
// The load and store operations, implemented by the LoadT and StoreT
// functions, are the atomic equivalents of "return *addr" and
// "*addr = val".
-//
package atomic
import (
//go:linkname runtime_entersyscall runtime.entersyscall
func runtime_entersyscall()
+
//go:linkname runtime_exitsyscall runtime.exitsyscall
func runtime_exitsyscall()