mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
std,cmd: go fix -any std cmd
This change mechanically replaces all occurrences of interface{}
by 'any' (where deemed safe by the 'any' modernizer) throughout
std and cmd, minus their vendor trees.
Since this fix is relatively numerous, it gets its own CL.
Also, 'go generate go/types'.
Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/719702
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
2263d4aabd
commit
4bfc3a9d14
99 changed files with 282 additions and 284 deletions
|
|
@ -38,7 +38,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
|
||||||
ctxt.IsAsm = true
|
ctxt.IsAsm = true
|
||||||
defer ctxt.Bso.Flush()
|
defer ctxt.Bso.Flush()
|
||||||
failed := false
|
failed := false
|
||||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
ctxt.DiagFunc = func(format string, args ...any) {
|
||||||
failed = true
|
failed = true
|
||||||
t.Errorf(format, args...)
|
t.Errorf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +193,7 @@ Diff:
|
||||||
top := pList.Firstpc
|
top := pList.Firstpc
|
||||||
var text *obj.LSym
|
var text *obj.LSym
|
||||||
ok = true
|
ok = true
|
||||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
ctxt.DiagFunc = func(format string, args ...any) {
|
||||||
t.Errorf(format, args...)
|
t.Errorf(format, args...)
|
||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
|
|
@ -294,7 +294,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
|
||||||
failed := false
|
failed := false
|
||||||
var errBuf bytes.Buffer
|
var errBuf bytes.Buffer
|
||||||
parser.errorWriter = &errBuf
|
parser.errorWriter = &errBuf
|
||||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
ctxt.DiagFunc = func(format string, args ...any) {
|
||||||
failed = true
|
failed = true
|
||||||
s := fmt.Sprintf(format, args...)
|
s := fmt.Sprintf(format, args...)
|
||||||
if !strings.HasSuffix(s, "\n") {
|
if !strings.HasSuffix(s, "\n") {
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func NewParser(ctxt *obj.Link, ar *arch.Arch, lexer lex.TokenReader) *Parser {
|
||||||
// and turn it into a recoverable panic.
|
// and turn it into a recoverable panic.
|
||||||
var panicOnError bool
|
var panicOnError bool
|
||||||
|
|
||||||
func (p *Parser) errorf(format string, args ...interface{}) {
|
func (p *Parser) errorf(format string, args ...any) {
|
||||||
if panicOnError {
|
if panicOnError {
|
||||||
panic(fmt.Errorf(format, args...))
|
panic(fmt.Errorf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ func (p *Parser) errorf(format string, args ...interface{}) {
|
||||||
if p.lex != nil {
|
if p.lex != nil {
|
||||||
// Put file and line information on head of message.
|
// Put file and line information on head of message.
|
||||||
format = "%s:%d: " + format + "\n"
|
format = "%s:%d: " + format + "\n"
|
||||||
args = append([]interface{}{p.lex.File(), p.lineNum}, args...)
|
args = append([]any{p.lex.File(), p.lineNum}, args...)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(p.errorWriter, format, args...)
|
fmt.Fprintf(p.errorWriter, format, args...)
|
||||||
p.errorCount++
|
p.errorCount++
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func predefine(defines flags.MultiFlag) map[string]*Macro {
|
||||||
|
|
||||||
var panicOnError bool // For testing.
|
var panicOnError bool // For testing.
|
||||||
|
|
||||||
func (in *Input) Error(args ...interface{}) {
|
func (in *Input) Error(args ...any) {
|
||||||
if panicOnError {
|
if panicOnError {
|
||||||
panic(fmt.Errorf("%s:%d: %s", in.File(), in.Line(), fmt.Sprintln(args...)))
|
panic(fmt.Errorf("%s:%d: %s", in.File(), in.Line(), fmt.Sprintln(args...)))
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ func (in *Input) Error(args ...interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// expectText is like Error but adds "got XXX" where XXX is a quoted representation of the most recent token.
|
// expectText is like Error but adds "got XXX" where XXX is a quoted representation of the most recent token.
|
||||||
func (in *Input) expectText(args ...interface{}) {
|
func (in *Input) expectText(args ...any) {
|
||||||
in.Error(append(args, "; got", strconv.Quote(in.Stack.Text()))...)
|
in.Error(append(args, "; got", strconv.Quote(in.Stack.Text()))...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func main() {
|
||||||
for _, f := range flag.Args() {
|
for _, f := range flag.Args() {
|
||||||
lexer := lex.NewLexer(f)
|
lexer := lex.NewLexer(f)
|
||||||
parser := asm.NewParser(ctxt, architecture, lexer)
|
parser := asm.NewParser(ctxt, architecture, lexer)
|
||||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
ctxt.DiagFunc = func(format string, args ...any) {
|
||||||
diag = true
|
diag = true
|
||||||
log.Printf(format, args...)
|
log.Printf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ func commentText(g *ast.CommentGroup) string {
|
||||||
return strings.Join(pieces, "")
|
return strings.Join(pieces, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) validateIdents(x interface{}, context astContext) {
|
func (f *File) validateIdents(x any, context astContext) {
|
||||||
if x, ok := x.(*ast.Ident); ok {
|
if x, ok := x.(*ast.Ident); ok {
|
||||||
if f.isMangledName(x.Name) {
|
if f.isMangledName(x.Name) {
|
||||||
error_(x.Pos(), "identifier %q may conflict with identifiers generated by cgo", x.Name)
|
error_(x.Pos(), "identifier %q may conflict with identifiers generated by cgo", x.Name)
|
||||||
|
|
@ -208,7 +208,7 @@ func (f *File) validateIdents(x interface{}, context astContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save various references we are going to need later.
|
// Save various references we are going to need later.
|
||||||
func (f *File) saveExprs(x interface{}, context astContext) {
|
func (f *File) saveExprs(x any, context astContext) {
|
||||||
switch x := x.(type) {
|
switch x := x.(type) {
|
||||||
case *ast.Expr:
|
case *ast.Expr:
|
||||||
switch (*x).(type) {
|
switch (*x).(type) {
|
||||||
|
|
@ -278,7 +278,7 @@ func (f *File) saveCall(call *ast.CallExpr, context astContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a function should be exported add it to ExpFunc.
|
// If a function should be exported add it to ExpFunc.
|
||||||
func (f *File) saveExport(x interface{}, context astContext) {
|
func (f *File) saveExport(x any, context astContext) {
|
||||||
n, ok := x.(*ast.FuncDecl)
|
n, ok := x.(*ast.FuncDecl)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
@ -318,7 +318,7 @@ func (f *File) saveExport(x interface{}, context astContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make f.ExpFunc[i] point at the Func from this AST instead of the other one.
|
// Make f.ExpFunc[i] point at the Func from this AST instead of the other one.
|
||||||
func (f *File) saveExport2(x interface{}, context astContext) {
|
func (f *File) saveExport2(x any, context astContext) {
|
||||||
n, ok := x.(*ast.FuncDecl)
|
n, ok := x.(*ast.FuncDecl)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
@ -355,7 +355,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// walk walks the AST x, calling visit(f, x, context) for each node.
|
// walk walks the AST x, calling visit(f, x, context) for each node.
|
||||||
func (f *File) walk(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
|
func (f *File) walk(x any, context astContext, visit func(*File, any, astContext)) {
|
||||||
visit(f, x, context)
|
visit(f, x, context)
|
||||||
switch n := x.(type) {
|
switch n := x.(type) {
|
||||||
case *ast.Expr:
|
case *ast.Expr:
|
||||||
|
|
|
||||||
|
|
@ -1158,7 +1158,7 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
|
||||||
// If addPosition is true, add position info to the idents of C names in arg.
|
// If addPosition is true, add position info to the idents of C names in arg.
|
||||||
func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bool) {
|
func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bool) {
|
||||||
needsUnsafe := false
|
needsUnsafe := false
|
||||||
f.walk(arg, ctxExpr, func(f *File, arg interface{}, context astContext) {
|
f.walk(arg, ctxExpr, func(f *File, arg any, context astContext) {
|
||||||
px, ok := arg.(*ast.Expr)
|
px, ok := arg.(*ast.Expr)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
@ -2439,7 +2439,7 @@ func (tr *TypeRepr) Empty() bool {
|
||||||
// Set modifies the type representation.
|
// Set modifies the type representation.
|
||||||
// If fargs are provided, repr is used as a format for fmt.Sprintf.
|
// If fargs are provided, repr is used as a format for fmt.Sprintf.
|
||||||
// Otherwise, repr is used unprocessed as the type representation.
|
// Otherwise, repr is used unprocessed as the type representation.
|
||||||
func (tr *TypeRepr) Set(repr string, fargs ...interface{}) {
|
func (tr *TypeRepr) Set(repr string, fargs ...any) {
|
||||||
tr.Repr = repr
|
tr.Repr = repr
|
||||||
tr.FormatArgs = fargs
|
tr.FormatArgs = fargs
|
||||||
}
|
}
|
||||||
|
|
@ -2713,7 +2713,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
|
||||||
// so execute the basic things that the struct case would do
|
// so execute the basic things that the struct case would do
|
||||||
// other than try to determine a Go representation.
|
// other than try to determine a Go representation.
|
||||||
tt := *t
|
tt := *t
|
||||||
tt.C = &TypeRepr{"%s %s", []interface{}{dt.Kind, tag}}
|
tt.C = &TypeRepr{"%s %s", []any{dt.Kind, tag}}
|
||||||
// We don't know what the representation of this struct is, so don't let
|
// We don't know what the representation of this struct is, so don't let
|
||||||
// anyone allocate one on the Go side. As a side effect of this annotation,
|
// anyone allocate one on the Go side. As a side effect of this annotation,
|
||||||
// pointers to this type will not be considered pointers in Go. They won't
|
// pointers to this type will not be considered pointers in Go. They won't
|
||||||
|
|
@ -2743,7 +2743,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
|
||||||
t.Align = align
|
t.Align = align
|
||||||
tt := *t
|
tt := *t
|
||||||
if tag != "" {
|
if tag != "" {
|
||||||
tt.C = &TypeRepr{"struct %s", []interface{}{tag}}
|
tt.C = &TypeRepr{"struct %s", []any{tag}}
|
||||||
}
|
}
|
||||||
tt.Go = g
|
tt.Go = g
|
||||||
if c.incompleteStructs[tag] {
|
if c.incompleteStructs[tag] {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ func (p *Package) godefs(f *File, args []string) string {
|
||||||
var gofmtBuf strings.Builder
|
var gofmtBuf strings.Builder
|
||||||
|
|
||||||
// gofmt returns the gofmt-formatted string for an AST node.
|
// gofmt returns the gofmt-formatted string for an AST node.
|
||||||
func gofmt(n interface{}) string {
|
func gofmt(n any) string {
|
||||||
gofmtBuf.Reset()
|
gofmtBuf.Reset()
|
||||||
err := printer.Fprint(&gofmtBuf, fset, n)
|
err := printer.Fprint(&gofmtBuf, fset, n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
|
||||||
var tmpDir string
|
var tmpDir string
|
||||||
|
|
||||||
// prettyPrintf prints lines with tmpDir sanitized.
|
// prettyPrintf prints lines with tmpDir sanitized.
|
||||||
func prettyPrintf(format string, args ...interface{}) {
|
func prettyPrintf(format string, args ...any) {
|
||||||
s := fmt.Sprintf(format, args...)
|
s := fmt.Sprintf(format, args...)
|
||||||
if tmpDir != "" {
|
if tmpDir != "" {
|
||||||
s = strings.ReplaceAll(s, tmpDir, "$TMPDIR")
|
s = strings.ReplaceAll(s, tmpDir, "$TMPDIR")
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ type ExpFunc struct {
|
||||||
// A TypeRepr contains the string representation of a type.
|
// A TypeRepr contains the string representation of a type.
|
||||||
type TypeRepr struct {
|
type TypeRepr struct {
|
||||||
Repr string
|
Repr string
|
||||||
FormatArgs []interface{}
|
FormatArgs []any
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Type collects information about a type in both the C and Go worlds.
|
// A Type collects information about a type in both the C and Go worlds.
|
||||||
|
|
|
||||||
|
|
@ -953,7 +953,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
|
||||||
npad := 0
|
npad := 0
|
||||||
// the align is at least 1 (for char)
|
// the align is at least 1 (for char)
|
||||||
maxAlign := int64(1)
|
maxAlign := int64(1)
|
||||||
argField := func(typ ast.Expr, namePat string, args ...interface{}) {
|
argField := func(typ ast.Expr, namePat string, args ...any) {
|
||||||
name := fmt.Sprintf(namePat, args...)
|
name := fmt.Sprintf(namePat, args...)
|
||||||
t := p.cgoType(typ)
|
t := p.cgoType(typ)
|
||||||
if off%t.Align != 0 {
|
if off%t.Align != 0 {
|
||||||
|
|
@ -1412,7 +1412,7 @@ func forFieldList(fl *ast.FieldList, fn func(int, string, ast.Expr)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func c(repr string, args ...interface{}) *TypeRepr {
|
func c(repr string, args ...any) *TypeRepr {
|
||||||
return &TypeRepr{repr, args}
|
return &TypeRepr{repr, args}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func lineno(pos token.Pos) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Die with an error message.
|
// Die with an error message.
|
||||||
func fatalf(msg string, args ...interface{}) {
|
func fatalf(msg string, args ...any) {
|
||||||
// If we've already printed other errors, they might have
|
// If we've already printed other errors, they might have
|
||||||
// caused the fatal condition. Assume they're enough.
|
// caused the fatal condition. Assume they're enough.
|
||||||
if nerrors == 0 {
|
if nerrors == 0 {
|
||||||
|
|
@ -86,7 +86,7 @@ func fatalf(msg string, args ...interface{}) {
|
||||||
|
|
||||||
var nerrors int
|
var nerrors int
|
||||||
|
|
||||||
func error_(pos token.Pos, msg string, args ...interface{}) {
|
func error_(pos token.Pos, msg string, args ...any) {
|
||||||
nerrors++
|
nerrors++
|
||||||
if pos.IsValid() {
|
if pos.IsValid() {
|
||||||
fmt.Fprintf(os.Stderr, "%s: ", fset.Position(pos).String())
|
fmt.Fprintf(os.Stderr, "%s: ", fset.Position(pos).String())
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ type T struct {
|
||||||
type node32 struct {
|
type node32 struct {
|
||||||
// Standard conventions hold for left = smaller, right = larger
|
// Standard conventions hold for left = smaller, right = larger
|
||||||
left, right *node32
|
left, right *node32
|
||||||
data interface{}
|
data any
|
||||||
key int32
|
key int32
|
||||||
height_ int8
|
height_ int8
|
||||||
}
|
}
|
||||||
|
|
@ -49,21 +49,21 @@ func (t *T) IsSingle() bool {
|
||||||
|
|
||||||
// VisitInOrder applies f to the key and data pairs in t,
|
// VisitInOrder applies f to the key and data pairs in t,
|
||||||
// with keys ordered from smallest to largest.
|
// with keys ordered from smallest to largest.
|
||||||
func (t *T) VisitInOrder(f func(int32, interface{})) {
|
func (t *T) VisitInOrder(f func(int32, any)) {
|
||||||
if t.root == nil {
|
if t.root == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.root.visitInOrder(f)
|
t.root.visitInOrder(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node32) nilOrData() interface{} {
|
func (n *node32) nilOrData() any {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return n.data
|
return n.data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node32) nilOrKeyAndData() (k int32, d interface{}) {
|
func (n *node32) nilOrKeyAndData() (k int32, d any) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
k = NOT_KEY32
|
k = NOT_KEY32
|
||||||
d = nil
|
d = nil
|
||||||
|
|
@ -83,7 +83,7 @@ func (n *node32) height() int8 {
|
||||||
|
|
||||||
// Find returns the data associated with x in the tree, or
|
// Find returns the data associated with x in the tree, or
|
||||||
// nil if x is not in the tree.
|
// nil if x is not in the tree.
|
||||||
func (t *T) Find(x int32) interface{} {
|
func (t *T) Find(x int32) any {
|
||||||
return t.root.find(x).nilOrData()
|
return t.root.find(x).nilOrData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ func (t *T) Find(x int32) interface{} {
|
||||||
// x was already a key in the tree. The previous data associated
|
// x was already a key in the tree. The previous data associated
|
||||||
// with x is returned, and is nil if x was not previously a
|
// with x is returned, and is nil if x was not previously a
|
||||||
// key in the tree.
|
// key in the tree.
|
||||||
func (t *T) Insert(x int32, data interface{}) interface{} {
|
func (t *T) Insert(x int32, data any) any {
|
||||||
if x == NOT_KEY32 {
|
if x == NOT_KEY32 {
|
||||||
panic("Cannot use sentinel value -0x80000000 as key")
|
panic("Cannot use sentinel value -0x80000000 as key")
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +105,7 @@ func (t *T) Insert(x int32, data interface{}) interface{} {
|
||||||
} else {
|
} else {
|
||||||
newroot, n, o = n.aInsert(x)
|
newroot, n, o = n.aInsert(x)
|
||||||
}
|
}
|
||||||
var r interface{}
|
var r any
|
||||||
if o != nil {
|
if o != nil {
|
||||||
r = o.data
|
r = o.data
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -121,7 +121,7 @@ func (t *T) Copy() *T {
|
||||||
return &u
|
return &u
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *T) Delete(x int32) interface{} {
|
func (t *T) Delete(x int32) any {
|
||||||
n := t.root
|
n := t.root
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -135,7 +135,7 @@ func (t *T) Delete(x int32) interface{} {
|
||||||
return d.data
|
return d.data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *T) DeleteMin() (int32, interface{}) {
|
func (t *T) DeleteMin() (int32, any) {
|
||||||
n := t.root
|
n := t.root
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return NOT_KEY32, nil
|
return NOT_KEY32, nil
|
||||||
|
|
@ -149,7 +149,7 @@ func (t *T) DeleteMin() (int32, interface{}) {
|
||||||
return d.key, d.data
|
return d.key, d.data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *T) DeleteMax() (int32, interface{}) {
|
func (t *T) DeleteMax() (int32, any) {
|
||||||
n := t.root
|
n := t.root
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return NOT_KEY32, nil
|
return NOT_KEY32, nil
|
||||||
|
|
@ -172,7 +172,7 @@ func (t *T) Size() int {
|
||||||
// not be symmetric. If f returns nil, then the key and data are not
|
// not be symmetric. If f returns nil, then the key and data are not
|
||||||
// added to the result. If f itself is nil, then whatever value was
|
// added to the result. If f itself is nil, then whatever value was
|
||||||
// already present in the smaller set is used.
|
// already present in the smaller set is used.
|
||||||
func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
|
func (t *T) Intersection(u *T, f func(x, y any) any) *T {
|
||||||
if t.Size() == 0 || u.Size() == 0 {
|
if t.Size() == 0 || u.Size() == 0 {
|
||||||
return &T{}
|
return &T{}
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +227,7 @@ func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
|
||||||
// is given by f(t's data, u's data) -- f need not be symmetric. If f returns nil,
|
// is given by f(t's data, u's data) -- f need not be symmetric. If f returns nil,
|
||||||
// then the key and data are not added to the result. If f itself is nil, then
|
// then the key and data are not added to the result. If f itself is nil, then
|
||||||
// whatever value was already present in the larger set is used.
|
// whatever value was already present in the larger set is used.
|
||||||
func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
|
func (t *T) Union(u *T, f func(x, y any) any) *T {
|
||||||
if t.Size() == 0 {
|
if t.Size() == 0 {
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +284,7 @@ func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
|
||||||
// of f applied to data corresponding to equal keys. If f returns nil
|
// of f applied to data corresponding to equal keys. If f returns nil
|
||||||
// (or if f is nil) then the key+data are excluded, as usual. If f
|
// (or if f is nil) then the key+data are excluded, as usual. If f
|
||||||
// returns not-nil, then that key+data pair is inserted. instead.
|
// returns not-nil, then that key+data pair is inserted. instead.
|
||||||
func (t *T) Difference(u *T, f func(x, y interface{}) interface{}) *T {
|
func (t *T) Difference(u *T, f func(x, y any) any) *T {
|
||||||
if t.Size() == 0 {
|
if t.Size() == 0 {
|
||||||
return &T{}
|
return &T{}
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +365,7 @@ func (t *node32) equals(u *node32) bool {
|
||||||
return it.done() == iu.done()
|
return it.done() == iu.done()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
|
func (t *T) Equiv(u *T, eqv func(x, y any) bool) bool {
|
||||||
if t == u {
|
if t == u {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +375,7 @@ func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
|
||||||
return t.root.equiv(u.root, eqv)
|
return t.root.equiv(u.root, eqv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *node32) equiv(u *node32, eqv func(x, y interface{}) bool) bool {
|
func (t *node32) equiv(u *node32, eqv func(x, y any) bool) bool {
|
||||||
if t == u {
|
if t == u {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -404,7 +404,7 @@ type Iterator struct {
|
||||||
it iterator
|
it iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
func (it *Iterator) Next() (int32, interface{}) {
|
func (it *Iterator) Next() (int32, any) {
|
||||||
x := it.it.next()
|
x := it.it.next()
|
||||||
if x == nil {
|
if x == nil {
|
||||||
return NOT_KEY32, nil
|
return NOT_KEY32, nil
|
||||||
|
|
@ -461,37 +461,37 @@ func (it *iterator) next() *node32 {
|
||||||
|
|
||||||
// Min returns the minimum element of t.
|
// Min returns the minimum element of t.
|
||||||
// If t is empty, then (NOT_KEY32, nil) is returned.
|
// If t is empty, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) Min() (k int32, d interface{}) {
|
func (t *T) Min() (k int32, d any) {
|
||||||
return t.root.min().nilOrKeyAndData()
|
return t.root.min().nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Max returns the maximum element of t.
|
// Max returns the maximum element of t.
|
||||||
// If t is empty, then (NOT_KEY32, nil) is returned.
|
// If t is empty, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) Max() (k int32, d interface{}) {
|
func (t *T) Max() (k int32, d any) {
|
||||||
return t.root.max().nilOrKeyAndData()
|
return t.root.max().nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Glb returns the greatest-lower-bound-exclusive of x and the associated
|
// Glb returns the greatest-lower-bound-exclusive of x and the associated
|
||||||
// data. If x has no glb in the tree, then (NOT_KEY32, nil) is returned.
|
// data. If x has no glb in the tree, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) Glb(x int32) (k int32, d interface{}) {
|
func (t *T) Glb(x int32) (k int32, d any) {
|
||||||
return t.root.glb(x, false).nilOrKeyAndData()
|
return t.root.glb(x, false).nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GlbEq returns the greatest-lower-bound-inclusive of x and the associated
|
// GlbEq returns the greatest-lower-bound-inclusive of x and the associated
|
||||||
// data. If x has no glbEQ in the tree, then (NOT_KEY32, nil) is returned.
|
// data. If x has no glbEQ in the tree, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) GlbEq(x int32) (k int32, d interface{}) {
|
func (t *T) GlbEq(x int32) (k int32, d any) {
|
||||||
return t.root.glb(x, true).nilOrKeyAndData()
|
return t.root.glb(x, true).nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lub returns the least-upper-bound-exclusive of x and the associated
|
// Lub returns the least-upper-bound-exclusive of x and the associated
|
||||||
// data. If x has no lub in the tree, then (NOT_KEY32, nil) is returned.
|
// data. If x has no lub in the tree, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) Lub(x int32) (k int32, d interface{}) {
|
func (t *T) Lub(x int32) (k int32, d any) {
|
||||||
return t.root.lub(x, false).nilOrKeyAndData()
|
return t.root.lub(x, false).nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LubEq returns the least-upper-bound-inclusive of x and the associated
|
// LubEq returns the least-upper-bound-inclusive of x and the associated
|
||||||
// data. If x has no lubEq in the tree, then (NOT_KEY32, nil) is returned.
|
// data. If x has no lubEq in the tree, then (NOT_KEY32, nil) is returned.
|
||||||
func (t *T) LubEq(x int32) (k int32, d interface{}) {
|
func (t *T) LubEq(x int32) (k int32, d any) {
|
||||||
return t.root.lub(x, true).nilOrKeyAndData()
|
return t.root.lub(x, true).nilOrKeyAndData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,7 +499,7 @@ func (t *node32) isLeaf() bool {
|
||||||
return t.left == nil && t.right == nil && t.height_ == LEAF_HEIGHT
|
return t.left == nil && t.right == nil && t.height_ == LEAF_HEIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *node32) visitInOrder(f func(int32, interface{})) {
|
func (t *node32) visitInOrder(f func(int32, any)) {
|
||||||
if t.left != nil {
|
if t.left != nil {
|
||||||
t.left.visitInOrder(f)
|
t.left.visitInOrder(f)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ func applicIterator(te *testing.T, x []int32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func equiv(a, b interface{}) bool {
|
func equiv(a, b any) bool {
|
||||||
sa, sb := a.(*sstring), b.(*sstring)
|
sa, sb := a.(*sstring), b.(*sstring)
|
||||||
return *sa == *sb
|
return *sa == *sb
|
||||||
}
|
}
|
||||||
|
|
@ -450,16 +450,16 @@ func TestEquals(t *testing.T) {
|
||||||
[]int32{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2})
|
[]int32{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2})
|
||||||
}
|
}
|
||||||
|
|
||||||
func first(x, y interface{}) interface{} {
|
func first(x, y any) any {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
func second(x, y interface{}) interface{} {
|
func second(x, y any) any {
|
||||||
return y
|
return y
|
||||||
}
|
}
|
||||||
func alwaysNil(x, y interface{}) interface{} {
|
func alwaysNil(x, y any) any {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func smaller(x, y interface{}) interface{} {
|
func smaller(x, y any) any {
|
||||||
xi, _ := strconv.Atoi(fmt.Sprint(x))
|
xi, _ := strconv.Atoi(fmt.Sprint(x))
|
||||||
yi, _ := strconv.Atoi(fmt.Sprint(y))
|
yi, _ := strconv.Atoi(fmt.Sprint(y))
|
||||||
if xi < yi {
|
if xi < yi {
|
||||||
|
|
@ -560,7 +560,7 @@ func (s *sstring) String() string {
|
||||||
return s.s
|
return s.s
|
||||||
}
|
}
|
||||||
|
|
||||||
func stringer(s string) interface{} {
|
func stringer(s string) any {
|
||||||
return &sstring{s}
|
return &sstring{s}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ func SyntaxErrors() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// addErrorMsg adds a new errorMsg (which may be a warning) to errorMsgs.
|
// addErrorMsg adds a new errorMsg (which may be a warning) to errorMsgs.
|
||||||
func addErrorMsg(pos src.XPos, code errors.Code, format string, args ...interface{}) {
|
func addErrorMsg(pos src.XPos, code errors.Code, format string, args ...any) {
|
||||||
msg := fmt.Sprintf(format, args...)
|
msg := fmt.Sprintf(format, args...)
|
||||||
// Only add the position if know the position.
|
// Only add the position if know the position.
|
||||||
// See issue golang.org/issue/11361.
|
// See issue golang.org/issue/11361.
|
||||||
|
|
@ -108,12 +108,12 @@ func sameline(a, b src.XPos) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Errorf reports a formatted error at the current line.
|
// Errorf reports a formatted error at the current line.
|
||||||
func Errorf(format string, args ...interface{}) {
|
func Errorf(format string, args ...any) {
|
||||||
ErrorfAt(Pos, 0, format, args...)
|
ErrorfAt(Pos, 0, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrorfAt reports a formatted error message at pos.
|
// ErrorfAt reports a formatted error message at pos.
|
||||||
func ErrorfAt(pos src.XPos, code errors.Code, format string, args ...interface{}) {
|
func ErrorfAt(pos src.XPos, code errors.Code, format string, args ...any) {
|
||||||
msg := fmt.Sprintf(format, args...)
|
msg := fmt.Sprintf(format, args...)
|
||||||
|
|
||||||
if strings.HasPrefix(msg, "syntax error") {
|
if strings.HasPrefix(msg, "syntax error") {
|
||||||
|
|
@ -164,7 +164,7 @@ func UpdateErrorDot(line string, name, expr string) {
|
||||||
// In general the Go compiler does NOT generate warnings,
|
// In general the Go compiler does NOT generate warnings,
|
||||||
// so this should be used only when the user has opted in
|
// so this should be used only when the user has opted in
|
||||||
// to additional output by setting a particular flag.
|
// to additional output by setting a particular flag.
|
||||||
func Warn(format string, args ...interface{}) {
|
func Warn(format string, args ...any) {
|
||||||
WarnfAt(Pos, format, args...)
|
WarnfAt(Pos, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ func Warn(format string, args ...interface{}) {
|
||||||
// In general the Go compiler does NOT generate warnings,
|
// In general the Go compiler does NOT generate warnings,
|
||||||
// so this should be used only when the user has opted in
|
// so this should be used only when the user has opted in
|
||||||
// to additional output by setting a particular flag.
|
// to additional output by setting a particular flag.
|
||||||
func WarnfAt(pos src.XPos, format string, args ...interface{}) {
|
func WarnfAt(pos src.XPos, format string, args ...any) {
|
||||||
addErrorMsg(pos, 0, format, args...)
|
addErrorMsg(pos, 0, format, args...)
|
||||||
if Flag.LowerM != 0 {
|
if Flag.LowerM != 0 {
|
||||||
FlushErrors()
|
FlushErrors()
|
||||||
|
|
@ -191,7 +191,7 @@ func WarnfAt(pos src.XPos, format string, args ...interface{}) {
|
||||||
// prints a stack trace.
|
// prints a stack trace.
|
||||||
//
|
//
|
||||||
// If -h has been specified, Fatalf panics to force the usual runtime info dump.
|
// If -h has been specified, Fatalf panics to force the usual runtime info dump.
|
||||||
func Fatalf(format string, args ...interface{}) {
|
func Fatalf(format string, args ...any) {
|
||||||
FatalfAt(Pos, format, args...)
|
FatalfAt(Pos, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ var bugStack = counter.NewStack("compile/bug", 16) // 16 is arbitrary; used by g
|
||||||
// prints a stack trace.
|
// prints a stack trace.
|
||||||
//
|
//
|
||||||
// If -h has been specified, FatalfAt panics to force the usual runtime info dump.
|
// If -h has been specified, FatalfAt panics to force the usual runtime info dump.
|
||||||
func FatalfAt(pos src.XPos, format string, args ...interface{}) {
|
func FatalfAt(pos src.XPos, format string, args ...any) {
|
||||||
FlushErrors()
|
FlushErrors()
|
||||||
|
|
||||||
bugStack.Inc()
|
bugStack.Inc()
|
||||||
|
|
@ -244,14 +244,14 @@ func Assert(b bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assertf reports a fatal error with Fatalf, unless b is true.
|
// Assertf reports a fatal error with Fatalf, unless b is true.
|
||||||
func Assertf(b bool, format string, args ...interface{}) {
|
func Assertf(b bool, format string, args ...any) {
|
||||||
if !b {
|
if !b {
|
||||||
Fatalf(format, args...)
|
Fatalf(format, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssertfAt reports a fatal error with FatalfAt, unless b is true.
|
// AssertfAt reports a fatal error with FatalfAt, unless b is true.
|
||||||
func AssertfAt(b bool, pos src.XPos, format string, args ...interface{}) {
|
func AssertfAt(b bool, pos src.XPos, format string, args ...any) {
|
||||||
if !b {
|
if !b {
|
||||||
FatalfAt(pos, format, args...)
|
FatalfAt(pos, format, args...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ type lines [][]string
|
||||||
|
|
||||||
func (lines *lines) add(label string, n int, dt, tot time.Duration, events []*event) {
|
func (lines *lines) add(label string, n int, dt, tot time.Duration, events []*event) {
|
||||||
var line []string
|
var line []string
|
||||||
add := func(format string, args ...interface{}) {
|
add := func(format string, args ...any) {
|
||||||
line = append(line, fmt.Sprintf(format, args...))
|
line = append(line, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DumpAny is like FDumpAny but prints to stderr.
|
// DumpAny is like FDumpAny but prints to stderr.
|
||||||
func DumpAny(root interface{}, filter string, depth int) {
|
func DumpAny(root any, filter string, depth int) {
|
||||||
FDumpAny(os.Stderr, root, filter, depth)
|
FDumpAny(os.Stderr, root, filter, depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ func DumpAny(root interface{}, filter string, depth int) {
|
||||||
// rather than their type; struct fields with zero values or
|
// rather than their type; struct fields with zero values or
|
||||||
// non-matching field names are omitted, and "…" means recursion
|
// non-matching field names are omitted, and "…" means recursion
|
||||||
// depth has been reached or struct fields have been omitted.
|
// depth has been reached or struct fields have been omitted.
|
||||||
func FDumpAny(w io.Writer, root interface{}, filter string, depth int) {
|
func FDumpAny(w io.Writer, root any, filter string, depth int) {
|
||||||
if root == nil {
|
if root == nil {
|
||||||
fmt.Fprintln(w, "nil")
|
fmt.Fprintln(w, "nil")
|
||||||
return
|
return
|
||||||
|
|
@ -110,7 +110,7 @@ func (p *dumper) Write(data []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf is a convenience wrapper.
|
// printf is a convenience wrapper.
|
||||||
func (p *dumper) printf(format string, args ...interface{}) {
|
func (p *dumper) printf(format string, args ...any) {
|
||||||
if _, err := fmt.Fprintf(p, format, args...); err != nil {
|
if _, err := fmt.Fprintf(p, format, args...); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ type Func struct {
|
||||||
Marks []Mark
|
Marks []Mark
|
||||||
|
|
||||||
FieldTrack map[*obj.LSym]struct{}
|
FieldTrack map[*obj.LSym]struct{}
|
||||||
DebugInfo interface{}
|
DebugInfo any
|
||||||
LSym *obj.LSym // Linker object in this function's native ABI (Func.ABI)
|
LSym *obj.LSym // Linker object in this function's native ABI (Func.ABI)
|
||||||
|
|
||||||
Inl *Inline
|
Inl *Inline
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ type Name struct {
|
||||||
Func *Func // TODO(austin): nil for I.M
|
Func *Func // TODO(austin): nil for I.M
|
||||||
Offset_ int64
|
Offset_ int64
|
||||||
val constant.Value
|
val constant.Value
|
||||||
Opt interface{} // for use by escape analysis
|
Opt any // for use by escape analysis
|
||||||
Embed *[]Embed // list of embedded files, for ONAME var
|
Embed *[]Embed // list of embedded files, for ONAME var
|
||||||
|
|
||||||
// For a local variable (not param) or extern, the initializing assignment (OAS or OAS2).
|
// For a local variable (not param) or extern, the initializing assignment (OAS or OAS2).
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func TestSizeof(t *testing.T) {
|
||||||
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
val interface{} // type as a value
|
val any // type as a value
|
||||||
_32bit uintptr // size on 32bit platforms
|
_32bit uintptr // size on 32bit platforms
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ type LoggedOpt struct {
|
||||||
compilerPass string // Compiler pass. For human/adhoc consumption; does not appear in JSON (yet)
|
compilerPass string // Compiler pass. For human/adhoc consumption; does not appear in JSON (yet)
|
||||||
functionName string // Function name. For human/adhoc consumption; does not appear in JSON (yet)
|
functionName string // Function name. For human/adhoc consumption; does not appear in JSON (yet)
|
||||||
what string // The (non) optimization; "nilcheck", "boundsCheck", "inline", "noInline"
|
what string // The (non) optimization; "nilcheck", "boundsCheck", "inline", "noInline"
|
||||||
target []interface{} // Optional target(s) or parameter(s) of "what" -- what was inlined, why it was not, size of copy, etc. 1st is most important/relevant.
|
target []any // Optional target(s) or parameter(s) of "what" -- what was inlined, why it was not, size of copy, etc. 1st is most important/relevant.
|
||||||
}
|
}
|
||||||
|
|
||||||
type logFormat uint8
|
type logFormat uint8
|
||||||
|
|
@ -325,7 +325,7 @@ var mu = sync.Mutex{} // mu protects loggedOpts.
|
||||||
// Pos is the source position (including inlining), what is the message, pass is which pass created the message,
|
// Pos is the source position (including inlining), what is the message, pass is which pass created the message,
|
||||||
// funcName is the name of the function
|
// funcName is the name of the function
|
||||||
// A typical use for this to accumulate an explanation for a missed optimization, for example, why did something escape?
|
// A typical use for this to accumulate an explanation for a missed optimization, for example, why did something escape?
|
||||||
func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{}) *LoggedOpt {
|
func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...any) *LoggedOpt {
|
||||||
pass = strings.ReplaceAll(pass, " ", "_")
|
pass = strings.ReplaceAll(pass, " ", "_")
|
||||||
return &LoggedOpt{pos, lastPos, pass, funcName, what, args}
|
return &LoggedOpt{pos, lastPos, pass, funcName, what, args}
|
||||||
}
|
}
|
||||||
|
|
@ -333,7 +333,7 @@ func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...in
|
||||||
// LogOpt logs information about a (usually missed) optimization performed by the compiler.
|
// LogOpt logs information about a (usually missed) optimization performed by the compiler.
|
||||||
// Pos is the source position (including inlining), what is the message, pass is which pass created the message,
|
// Pos is the source position (including inlining), what is the message, pass is which pass created the message,
|
||||||
// funcName is the name of the function.
|
// funcName is the name of the function.
|
||||||
func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) {
|
func LogOpt(pos src.XPos, what, pass, funcName string, args ...any) {
|
||||||
if Format == None {
|
if Format == None {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -346,7 +346,7 @@ func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) {
|
||||||
|
|
||||||
// LogOptRange is the same as LogOpt, but includes the ability to express a range of positions,
|
// LogOptRange is the same as LogOpt, but includes the ability to express a range of positions,
|
||||||
// not just a point.
|
// not just a point.
|
||||||
func LogOptRange(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{}) {
|
func LogOptRange(pos, lastPos src.XPos, what, pass, funcName string, args ...any) {
|
||||||
if Format == None {
|
if Format == None {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ func LogTransformations(transformed []VarAndLoop) {
|
||||||
|
|
||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
// For automated checking of coverage of this transformation, include this in the JSON information.
|
// For automated checking of coverage of this transformation, include this in the JSON information.
|
||||||
var nString interface{} = n
|
var nString any = n
|
||||||
if inner != outer {
|
if inner != outer {
|
||||||
nString = fmt.Sprintf("%v (from inline)", n)
|
nString = fmt.Sprintf("%v (from inline)", n)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,12 +120,12 @@ func newPkgWriter(m posMap, pkg *types2.Package, info *types2.Info, otherInfo ma
|
||||||
}
|
}
|
||||||
|
|
||||||
// errorf reports a user error about thing p.
|
// errorf reports a user error about thing p.
|
||||||
func (pw *pkgWriter) errorf(p poser, msg string, args ...interface{}) {
|
func (pw *pkgWriter) errorf(p poser, msg string, args ...any) {
|
||||||
base.ErrorfAt(pw.m.pos(p), 0, msg, args...)
|
base.ErrorfAt(pw.m.pos(p), 0, msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// fatalf reports an internal compiler error about thing p.
|
// fatalf reports an internal compiler error about thing p.
|
||||||
func (pw *pkgWriter) fatalf(p poser, msg string, args ...interface{}) {
|
func (pw *pkgWriter) fatalf(p poser, msg string, args ...any) {
|
||||||
base.FatalfAt(pw.m.pos(p), msg, args...)
|
base.FatalfAt(pw.m.pos(p), msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -424,9 +424,9 @@ func (b *Block) likelyBranch() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) Logf(msg string, args ...interface{}) { b.Func.Logf(msg, args...) }
|
func (b *Block) Logf(msg string, args ...any) { b.Func.Logf(msg, args...) }
|
||||||
func (b *Block) Log() bool { return b.Func.Log() }
|
func (b *Block) Log() bool { return b.Func.Log() }
|
||||||
func (b *Block) Fatalf(msg string, args ...interface{}) { b.Func.Fatalf(msg, args...) }
|
func (b *Block) Fatalf(msg string, args ...any) { b.Func.Fatalf(msg, args...) }
|
||||||
|
|
||||||
type BranchPrediction int8
|
type BranchPrediction int8
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type Cache struct {
|
||||||
ValueToProgAfter []*obj.Prog
|
ValueToProgAfter []*obj.Prog
|
||||||
debugState debugState
|
debugState debugState
|
||||||
|
|
||||||
Liveness interface{} // *gc.livenessFuncCache
|
Liveness any // *gc.livenessFuncCache
|
||||||
|
|
||||||
// Free "headers" for use by the allocators in allocators.go.
|
// Free "headers" for use by the allocators in allocators.go.
|
||||||
// Used to put slices in sync.Pools without allocation.
|
// Used to put slices in sync.Pools without allocation.
|
||||||
|
|
|
||||||
|
|
@ -126,17 +126,17 @@ func (t *Types) SetTypPtrs() {
|
||||||
|
|
||||||
type Logger interface {
|
type Logger interface {
|
||||||
// Logf logs a message from the compiler.
|
// Logf logs a message from the compiler.
|
||||||
Logf(string, ...interface{})
|
Logf(string, ...any)
|
||||||
|
|
||||||
// Log reports whether logging is not a no-op
|
// Log reports whether logging is not a no-op
|
||||||
// some logging calls account for more than a few heap allocations.
|
// some logging calls account for more than a few heap allocations.
|
||||||
Log() bool
|
Log() bool
|
||||||
|
|
||||||
// Fatalf reports a compiler error and exits.
|
// Fatalf reports a compiler error and exits.
|
||||||
Fatalf(pos src.XPos, msg string, args ...interface{})
|
Fatalf(pos src.XPos, msg string, args ...any)
|
||||||
|
|
||||||
// Warnl writes compiler messages in the form expected by "errorcheck" tests
|
// Warnl writes compiler messages in the form expected by "errorcheck" tests
|
||||||
Warnl(pos src.XPos, fmt_ string, args ...interface{})
|
Warnl(pos src.XPos, fmt_ string, args ...any)
|
||||||
|
|
||||||
// Forwards the Debug flags from gc
|
// Forwards the Debug flags from gc
|
||||||
Debug_checknil() bool
|
Debug_checknil() bool
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ func BenchmarkCopyElim100000(b *testing.B) { benchmarkCopyElim(b, 100000) }
|
||||||
func benchmarkCopyElim(b *testing.B, n int) {
|
func benchmarkCopyElim(b *testing.B, n int) {
|
||||||
c := testConfig(b)
|
c := testConfig(b)
|
||||||
|
|
||||||
values := make([]interface{}, 0, n+2)
|
values := make([]any, 0, n+2)
|
||||||
values = append(values, Valu("mem", OpInitMem, types.TypeMem, 0, nil))
|
values = append(values, Valu("mem", OpInitMem, types.TypeMem, 0, nil))
|
||||||
last := "mem"
|
last := "mem"
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ type RegisterSet uint64
|
||||||
// logf prints debug-specific logging to stdout (always stdout) if the
|
// logf prints debug-specific logging to stdout (always stdout) if the
|
||||||
// current function is tagged by GOSSAFUNC (for ssa output directed
|
// current function is tagged by GOSSAFUNC (for ssa output directed
|
||||||
// either to stdout or html).
|
// either to stdout or html).
|
||||||
func (s *debugState) logf(msg string, args ...interface{}) {
|
func (s *debugState) logf(msg string, args ...any) {
|
||||||
if s.f.PrintOrHtmlSSA {
|
if s.f.PrintOrHtmlSSA {
|
||||||
fmt.Printf(msg, args...)
|
fmt.Printf(msg, args...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -951,7 +951,7 @@ func (x *expandState) indent(n int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Printf does an indented fmt.Printf on the format and args.
|
// Printf does an indented fmt.Printf on the format and args.
|
||||||
func (x *expandState) Printf(format string, a ...interface{}) (n int, err error) {
|
func (x *expandState) Printf(format string, a ...any) (n int, err error) {
|
||||||
if x.indentLevel > 0 {
|
if x.indentLevel > 0 {
|
||||||
fmt.Printf("%[1]*s", x.indentLevel, "")
|
fmt.Printf("%[1]*s", x.indentLevel, "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,11 @@ func (TestFrontend) UseWriteBarrier() bool {
|
||||||
return true // only writebarrier_test cares
|
return true // only writebarrier_test cares
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d TestFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
|
func (d TestFrontend) Logf(msg string, args ...any) { d.t.Logf(msg, args...) }
|
||||||
func (d TestFrontend) Log() bool { return true }
|
func (d TestFrontend) Log() bool { return true }
|
||||||
|
|
||||||
func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) }
|
func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...any) { d.t.Fatalf(msg, args...) }
|
||||||
func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
|
func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...any) { d.t.Logf(msg, args...) }
|
||||||
func (d TestFrontend) Debug_checknil() bool { return false }
|
func (d TestFrontend) Debug_checknil() bool { return false }
|
||||||
|
|
||||||
func (d TestFrontend) Func() *ir.Func {
|
func (d TestFrontend) Func() *ir.Func {
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@ func (f *Func) newValueNoBlock(op Op, t *types.Type, pos src.XPos) *Value {
|
||||||
// context to allow item-by-item comparisons across runs.
|
// context to allow item-by-item comparisons across runs.
|
||||||
// For example:
|
// For example:
|
||||||
// awk 'BEGIN {FS="\t"} $3~/TIME/{sum+=$4} END{print "t(ns)=",sum}' t.log
|
// awk 'BEGIN {FS="\t"} $3~/TIME/{sum+=$4} END{print "t(ns)=",sum}' t.log
|
||||||
func (f *Func) LogStat(key string, args ...interface{}) {
|
func (f *Func) LogStat(key string, args ...any) {
|
||||||
value := ""
|
value := ""
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
value += fmt.Sprintf("\t%v", a)
|
value += fmt.Sprintf("\t%v", a)
|
||||||
|
|
@ -730,11 +730,11 @@ func (f *Func) ConstOffPtrSP(t *types.Type, c int64, sp *Value) *Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Func) Frontend() Frontend { return f.fe }
|
func (f *Func) Frontend() Frontend { return f.fe }
|
||||||
func (f *Func) Warnl(pos src.XPos, msg string, args ...interface{}) { f.fe.Warnl(pos, msg, args...) }
|
func (f *Func) Warnl(pos src.XPos, msg string, args ...any) { f.fe.Warnl(pos, msg, args...) }
|
||||||
func (f *Func) Logf(msg string, args ...interface{}) { f.fe.Logf(msg, args...) }
|
func (f *Func) Logf(msg string, args ...any) { f.fe.Logf(msg, args...) }
|
||||||
func (f *Func) Log() bool { return f.fe.Log() }
|
func (f *Func) Log() bool { return f.fe.Log() }
|
||||||
|
|
||||||
func (f *Func) Fatalf(msg string, args ...interface{}) {
|
func (f *Func) Fatalf(msg string, args ...any) {
|
||||||
stats := "crashed"
|
stats := "crashed"
|
||||||
if f.Log() {
|
if f.Log() {
|
||||||
f.Logf(" pass %s end %s\n", f.pass.name, stats)
|
f.Logf(" pass %s end %s\n", f.pass.name, stats)
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ func (c *Conf) Fun(entry string, blocs ...bloc) fun {
|
||||||
// Bloc defines a block for Fun. The bloc name should be unique
|
// Bloc defines a block for Fun. The bloc name should be unique
|
||||||
// across the containing Fun. entries should consist of calls to valu,
|
// across the containing Fun. entries should consist of calls to valu,
|
||||||
// as well as one call to Goto, If, or Exit to specify the block kind.
|
// as well as one call to Goto, If, or Exit to specify the block kind.
|
||||||
func Bloc(name string, entries ...interface{}) bloc {
|
func Bloc(name string, entries ...any) bloc {
|
||||||
b := bloc{}
|
b := bloc{}
|
||||||
b.name = name
|
b.name = name
|
||||||
seenCtrl := false
|
seenCtrl := false
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,13 @@ func NewHTMLWriter(path string, f *Func, cfgMask string) *HTMLWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fatalf reports an error and exits.
|
// Fatalf reports an error and exits.
|
||||||
func (w *HTMLWriter) Fatalf(msg string, args ...interface{}) {
|
func (w *HTMLWriter) Fatalf(msg string, args ...any) {
|
||||||
fe := w.Func.Frontend()
|
fe := w.Func.Frontend()
|
||||||
fe.Fatalf(src.NoXPos, msg, args...)
|
fe.Fatalf(src.NoXPos, msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logf calls the (w *HTMLWriter).Func's Logf method passing along a msg and args.
|
// Logf calls the (w *HTMLWriter).Func's Logf method passing along a msg and args.
|
||||||
func (w *HTMLWriter) Logf(msg string, args ...interface{}) {
|
func (w *HTMLWriter) Logf(msg string, args ...any) {
|
||||||
w.Func.Logf(msg, args...)
|
w.Func.Logf(msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -945,7 +945,7 @@ func (w *HTMLWriter) WriteMultiTitleColumn(phase string, titles []string, class,
|
||||||
w.WriteString("</td>\n")
|
w.WriteString("</td>\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *HTMLWriter) Printf(msg string, v ...interface{}) {
|
func (w *HTMLWriter) Printf(msg string, v ...any) {
|
||||||
if _, err := fmt.Fprintf(w.w, msg, v...); err != nil {
|
if _, err := fmt.Fprintf(w.w, msg, v...); err != nil {
|
||||||
w.Fatalf("%v", err)
|
w.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,13 @@ type ValHeap struct {
|
||||||
func (h ValHeap) Len() int { return len(h.a) }
|
func (h ValHeap) Len() int { return len(h.a) }
|
||||||
func (h ValHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
|
func (h ValHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
|
||||||
|
|
||||||
func (h *ValHeap) Push(x interface{}) {
|
func (h *ValHeap) Push(x any) {
|
||||||
// Push and Pop use pointer receivers because they modify the slice's length,
|
// Push and Pop use pointer receivers because they modify the slice's length,
|
||||||
// not just its contents.
|
// not just its contents.
|
||||||
v := x.(*Value)
|
v := x.(*Value)
|
||||||
h.a = append(h.a, v)
|
h.a = append(h.a, v)
|
||||||
}
|
}
|
||||||
func (h *ValHeap) Pop() interface{} {
|
func (h *ValHeap) Pop() any {
|
||||||
old := h.a
|
old := h.a
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func TestSizeof(t *testing.T) {
|
||||||
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
val interface{} // type as a value
|
val any // type as a value
|
||||||
_32bit uintptr // size on 32bit platforms
|
_32bit uintptr // size on 32bit platforms
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
|
|
|
||||||
|
|
@ -471,9 +471,9 @@ func (v *Value) copyIntoWithXPos(b *Block, pos src.XPos) *Value {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Value) Logf(msg string, args ...interface{}) { v.Block.Logf(msg, args...) }
|
func (v *Value) Logf(msg string, args ...any) { v.Block.Logf(msg, args...) }
|
||||||
func (v *Value) Log() bool { return v.Block.Log() }
|
func (v *Value) Log() bool { return v.Block.Log() }
|
||||||
func (v *Value) Fatalf(msg string, args ...interface{}) {
|
func (v *Value) Fatalf(msg string, args ...any) {
|
||||||
v.Block.Func.fe.Fatalf(v.Pos, msg, args...)
|
v.Block.Func.fe.Fatalf(v.Pos, msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -396,11 +396,11 @@ type blockHeap struct {
|
||||||
func (h *blockHeap) Len() int { return len(h.a) }
|
func (h *blockHeap) Len() int { return len(h.a) }
|
||||||
func (h *blockHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
|
func (h *blockHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
|
||||||
|
|
||||||
func (h *blockHeap) Push(x interface{}) {
|
func (h *blockHeap) Push(x any) {
|
||||||
v := x.(*ssa.Block)
|
v := x.(*ssa.Block)
|
||||||
h.a = append(h.a, v)
|
h.a = append(h.a, v)
|
||||||
}
|
}
|
||||||
func (h *blockHeap) Pop() interface{} {
|
func (h *blockHeap) Pop() any {
|
||||||
old := h.a
|
old := h.a
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
|
|
|
||||||
|
|
@ -1115,12 +1115,12 @@ func (s *state) label(sym *types.Sym) *ssaLabel {
|
||||||
return lab
|
return lab
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state) Logf(msg string, args ...interface{}) { s.f.Logf(msg, args...) }
|
func (s *state) Logf(msg string, args ...any) { s.f.Logf(msg, args...) }
|
||||||
func (s *state) Log() bool { return s.f.Log() }
|
func (s *state) Log() bool { return s.f.Log() }
|
||||||
func (s *state) Fatalf(msg string, args ...interface{}) {
|
func (s *state) Fatalf(msg string, args ...any) {
|
||||||
s.f.Frontend().Fatalf(s.peekPos(), msg, args...)
|
s.f.Frontend().Fatalf(s.peekPos(), msg, args...)
|
||||||
}
|
}
|
||||||
func (s *state) Warnl(pos src.XPos, msg string, args ...interface{}) { s.f.Warnl(pos, msg, args...) }
|
func (s *state) Warnl(pos src.XPos, msg string, args ...any) { s.f.Warnl(pos, msg, args...) }
|
||||||
func (s *state) Debug_checknil() bool { return s.f.Frontend().Debug_checknil() }
|
func (s *state) Debug_checknil() bool { return s.f.Frontend().Debug_checknil() }
|
||||||
|
|
||||||
func ssaMarker(name string) *ir.Name {
|
func ssaMarker(name string) *ir.Name {
|
||||||
|
|
@ -7714,7 +7714,7 @@ func (e *ssafn) SplitSlot(parent *ssa.LocalSlot, suffix string, offset int64, t
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logf logs a message from the compiler.
|
// Logf logs a message from the compiler.
|
||||||
func (e *ssafn) Logf(msg string, args ...interface{}) {
|
func (e *ssafn) Logf(msg string, args ...any) {
|
||||||
if e.log {
|
if e.log {
|
||||||
fmt.Printf(msg, args...)
|
fmt.Printf(msg, args...)
|
||||||
}
|
}
|
||||||
|
|
@ -7725,15 +7725,15 @@ func (e *ssafn) Log() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fatalf reports a compiler error and exits.
|
// Fatalf reports a compiler error and exits.
|
||||||
func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...interface{}) {
|
func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...any) {
|
||||||
base.Pos = pos
|
base.Pos = pos
|
||||||
nargs := append([]interface{}{ir.FuncName(e.curfn)}, args...)
|
nargs := append([]any{ir.FuncName(e.curfn)}, args...)
|
||||||
base.Fatalf("'%s': "+msg, nargs...)
|
base.Fatalf("'%s': "+msg, nargs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warnl reports a "warning", which is usually flag-triggered
|
// Warnl reports a "warning", which is usually flag-triggered
|
||||||
// logging output for the benefit of tests.
|
// logging output for the benefit of tests.
|
||||||
func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...interface{}) {
|
func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...any) {
|
||||||
base.WarnfAt(pos, fmt_, args...)
|
base.WarnfAt(pos, fmt_, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ type block struct {
|
||||||
lstmt *LabeledStmt // labeled statement associated with this block, or nil
|
lstmt *LabeledStmt // labeled statement associated with this block, or nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *labelScope) errf(pos Pos, format string, args ...interface{}) {
|
func (ls *labelScope) errf(pos Pos, format string, args ...any) {
|
||||||
ls.errh(Error{pos, fmt.Sprintf(format, args...)})
|
ls.errh(Error{pos, fmt.Sprintf(format, args...)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ type writeError struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf is a convenience wrapper that takes care of print errors.
|
// printf is a convenience wrapper that takes care of print errors.
|
||||||
func (p *dumper) printf(format string, args ...interface{}) {
|
func (p *dumper) printf(format string, args ...any) {
|
||||||
if _, err := fmt.Fprintf(p, format, args...); err != nil {
|
if _, err := fmt.Fprintf(p, format, args...); err != nil {
|
||||||
panic(writeError{err})
|
panic(writeError{err})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ func mayCombine(prev token, next byte) (b bool) {
|
||||||
// return
|
// return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *printer) print(args ...interface{}) {
|
func (p *printer) print(args ...any) {
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
switch x := args[i].(type) {
|
switch x := args[i].(type) {
|
||||||
case nil:
|
case nil:
|
||||||
|
|
@ -455,7 +455,7 @@ func (p *printer) printRawNode(n Node) {
|
||||||
p.printExprList(n.ElemList)
|
p.printExprList(n.ElemList)
|
||||||
|
|
||||||
case *ArrayType:
|
case *ArrayType:
|
||||||
var len interface{} = _DotDotDot
|
var len any = _DotDotDot
|
||||||
if n.Len != nil {
|
if n.Len != nil {
|
||||||
len = n.Len
|
len = n.Len
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,12 @@ func (s *scanner) init(src io.Reader, errh func(line, col uint, msg string), mod
|
||||||
}
|
}
|
||||||
|
|
||||||
// errorf reports an error at the most recently read character position.
|
// errorf reports an error at the most recently read character position.
|
||||||
func (s *scanner) errorf(format string, args ...interface{}) {
|
func (s *scanner) errorf(format string, args ...any) {
|
||||||
s.error(fmt.Sprintf(format, args...))
|
s.error(fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// errorAtf reports an error at a byte column offset relative to the current token start.
|
// errorAtf reports an error at a byte column offset relative to the current token start.
|
||||||
func (s *scanner) errorAtf(offset int, format string, args ...interface{}) {
|
func (s *scanner) errorAtf(offset int, format string, args ...any) {
|
||||||
s.errh(s.line, s.col+uint(offset), fmt.Sprintf(format, args...))
|
s.errh(s.line, s.col+uint(offset), fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ type ErrorHandler func(err error)
|
||||||
// A Pragma value augments a package, import, const, func, type, or var declaration.
|
// A Pragma value augments a package, import, const, func, type, or var declaration.
|
||||||
// Its meaning is entirely up to the PragmaHandler,
|
// Its meaning is entirely up to the PragmaHandler,
|
||||||
// except that nil is used to mean “no pragma seen.”
|
// except that nil is used to mean “no pragma seen.”
|
||||||
type Pragma interface{}
|
type Pragma any
|
||||||
|
|
||||||
// A PragmaHandler is used to process //go: directives while scanning.
|
// A PragmaHandler is used to process //go: directives while scanning.
|
||||||
// It is passed the current pragma value, which starts out being nil,
|
// It is passed the current pragma value, which starts out being nil,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ func makeT() T {
|
||||||
|
|
||||||
var g T
|
var g T
|
||||||
|
|
||||||
var sink interface{}
|
var sink any
|
||||||
|
|
||||||
func TestIssue15854(t *testing.T) {
|
func TestIssue15854(t *testing.T) {
|
||||||
for i := 0; i < 10000; i++ {
|
for i := 0; i < 10000; i++ {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ var x int
|
||||||
|
|
||||||
func TestEfaceConv1(t *testing.T) {
|
func TestEfaceConv1(t *testing.T) {
|
||||||
a := 5
|
a := 5
|
||||||
i := interface{}(a)
|
i := any(a)
|
||||||
a += 2
|
a += 2
|
||||||
if got := i.(int); got != 5 {
|
if got := i.(int); got != 5 {
|
||||||
t.Errorf("wanted 5, got %d\n", got)
|
t.Errorf("wanted 5, got %d\n", got)
|
||||||
|
|
@ -23,7 +23,7 @@ func TestEfaceConv1(t *testing.T) {
|
||||||
func TestEfaceConv2(t *testing.T) {
|
func TestEfaceConv2(t *testing.T) {
|
||||||
a := 5
|
a := 5
|
||||||
sink = &a
|
sink = &a
|
||||||
i := interface{}(a)
|
i := any(a)
|
||||||
a += 2
|
a += 2
|
||||||
if got := i.(int); got != 5 {
|
if got := i.(int); got != 5 {
|
||||||
t.Errorf("wanted 5, got %d\n", got)
|
t.Errorf("wanted 5, got %d\n", got)
|
||||||
|
|
@ -38,7 +38,7 @@ func TestEfaceConv3(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
//go:noinline
|
||||||
func e2int3(i interface{}) int {
|
func e2int3(i any) int {
|
||||||
x = 7
|
x = 7
|
||||||
return i.(int)
|
return i.(int)
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ func TestEfaceConv4(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
//go:noinline
|
||||||
func e2int4(i interface{}, p *int) int {
|
func e2int4(i any, p *int) int {
|
||||||
*p = 7
|
*p = 7
|
||||||
return i.(int)
|
return i.(int)
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ func (i Int) foo() {
|
||||||
|
|
||||||
func TestIfaceConv1(t *testing.T) {
|
func TestIfaceConv1(t *testing.T) {
|
||||||
a := Int(5)
|
a := Int(5)
|
||||||
i := interface{}(a)
|
i := any(a)
|
||||||
a += 2
|
a += 2
|
||||||
if got := i.(Int); got != 5 {
|
if got := i.(Int); got != 5 {
|
||||||
t.Errorf("wanted 5, got %d\n", int(got))
|
t.Errorf("wanted 5, got %d\n", int(got))
|
||||||
|
|
@ -79,7 +79,7 @@ func TestIfaceConv1(t *testing.T) {
|
||||||
func TestIfaceConv2(t *testing.T) {
|
func TestIfaceConv2(t *testing.T) {
|
||||||
a := Int(5)
|
a := Int(5)
|
||||||
sink = &a
|
sink = &a
|
||||||
i := interface{}(a)
|
i := any(a)
|
||||||
a += 2
|
a += 2
|
||||||
if got := i.(Int); got != 5 {
|
if got := i.(Int); got != 5 {
|
||||||
t.Errorf("wanted 5, got %d\n", int(got))
|
t.Errorf("wanted 5, got %d\n", int(got))
|
||||||
|
|
@ -121,7 +121,7 @@ func BenchmarkEfaceInteger(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
//go:noinline
|
||||||
func i2int(i interface{}) int {
|
func i2int(i any) int {
|
||||||
return i.(int)
|
return i.(int)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -916,7 +916,7 @@ func TestShiftGeneric(t *testing.T) {
|
||||||
signed bool
|
signed bool
|
||||||
shiftWidth int
|
shiftWidth int
|
||||||
left bool
|
left bool
|
||||||
f interface{}
|
f any
|
||||||
}{
|
}{
|
||||||
{64, true, 64, true, func(n int64, s uint64) int64 { return n << s }},
|
{64, true, 64, true, func(n int64, s uint64) int64 { return n << s }},
|
||||||
{64, true, 64, false, func(n int64, s uint64) int64 { return n >> s }},
|
{64, true, 64, false, func(n int64, s uint64) int64 { return n >> s }},
|
||||||
|
|
|
||||||
|
|
@ -713,7 +713,7 @@ func implicitstar(n ir.Node) ir.Node {
|
||||||
return Expr(star)
|
return Expr(star)
|
||||||
}
|
}
|
||||||
|
|
||||||
func needOneArg(n *ir.CallExpr, f string, args ...interface{}) (ir.Node, bool) {
|
func needOneArg(n *ir.CallExpr, f string, args ...any) (ir.Node, bool) {
|
||||||
if len(n.Args) == 0 {
|
if len(n.Args) == 0 {
|
||||||
p := fmt.Sprintf(f, args...)
|
p := fmt.Sprintf(f, args...)
|
||||||
base.Errorf("missing argument to %s: %v", p, n)
|
base.Errorf("missing argument to %s: %v", p, n)
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ var BasicTypeNames = []string{
|
||||||
}
|
}
|
||||||
|
|
||||||
var fmtBufferPool = sync.Pool{
|
var fmtBufferPool = sync.Pool{
|
||||||
New: func() interface{} {
|
New: func() any {
|
||||||
return new(bytes.Buffer)
|
return new(bytes.Buffer)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func TestSizeof(t *testing.T) {
|
||||||
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
val interface{} // type as a value
|
val any // type as a value
|
||||||
_32bit uintptr // size on 32bit platforms
|
_32bit uintptr // size on 32bit platforms
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ type Type struct {
|
||||||
// TARRAY: *Array
|
// TARRAY: *Array
|
||||||
// TSLICE: Slice
|
// TSLICE: Slice
|
||||||
// TSSA: string
|
// TSSA: string
|
||||||
extra interface{}
|
extra any
|
||||||
|
|
||||||
// width is the width of this Type in bytes.
|
// width is the width of this Type in bytes.
|
||||||
width int64 // valid if Align > 0
|
width int64 // valid if Align > 0
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ type action struct {
|
||||||
|
|
||||||
// If debug is set, describef sets a printf-formatted description for action a.
|
// If debug is set, describef sets a printf-formatted description for action a.
|
||||||
// Otherwise, it is a no-op.
|
// Otherwise, it is a no-op.
|
||||||
func (a *action) describef(pos poser, format string, args ...interface{}) {
|
func (a *action) describef(pos poser, format string, args ...any) {
|
||||||
if debug {
|
if debug {
|
||||||
a.desc = &actionDesc{pos, format, args}
|
a.desc = &actionDesc{pos, format, args}
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ func (a *action) describef(pos poser, format string, args ...interface{}) {
|
||||||
type actionDesc struct {
|
type actionDesc struct {
|
||||||
pos poser
|
pos poser
|
||||||
format string
|
format string
|
||||||
args []interface{}
|
args []any
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Checker maintains the state of the type checker.
|
// A Checker maintains the state of the type checker.
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ func (check *Checker) newError(code Code) *error_ {
|
||||||
// Subsequent calls to addf provide additional information in the form of additional lines
|
// Subsequent calls to addf provide additional information in the form of additional lines
|
||||||
// in the error message (types2) or continuation errors identified by a tab-indented error
|
// in the error message (types2) or continuation errors identified by a tab-indented error
|
||||||
// message (go/types).
|
// message (go/types).
|
||||||
func (err *error_) addf(at poser, format string, args ...interface{}) {
|
func (err *error_) addf(at poser, format string, args ...any) {
|
||||||
err.desc = append(err.desc, errorDesc{atPos(at), err.check.sprintf(format, args...)})
|
err.desc = append(err.desc, errorDesc{atPos(at), err.check.sprintf(format, args...)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1247,7 +1247,7 @@ Error:
|
||||||
// represented as an integer (such as 1.0) it is returned as an integer value.
|
// represented as an integer (such as 1.0) it is returned as an integer value.
|
||||||
// This ensures that constants of different kind but equal value (such as
|
// This ensures that constants of different kind but equal value (such as
|
||||||
// 1.0 + 0i, 1.0, 1) result in the same value.
|
// 1.0 + 0i, 1.0, 1) result in the same value.
|
||||||
func keyVal(x constant.Value) interface{} {
|
func keyVal(x constant.Value) any {
|
||||||
switch x.Kind() {
|
switch x.Kind() {
|
||||||
case constant.Complex:
|
case constant.Complex:
|
||||||
f := constant.ToFloat(x)
|
f := constant.ToFloat(x)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ type gen struct {
|
||||||
bytes.Buffer
|
bytes.Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *gen) p(format string, args ...interface{}) {
|
func (g *gen) p(format string, args ...any) {
|
||||||
fmt.Fprintf(&g.Buffer, format, args...)
|
fmt.Fprintf(&g.Buffer, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ func TestSizeof(t *testing.T) {
|
||||||
const _64bit = ^uint(0)>>32 != 0
|
const _64bit = ^uint(0)>>32 != 0
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
val interface{} // type as a value
|
val any // type as a value
|
||||||
_32bit uintptr // size on 32bit platforms
|
_32bit uintptr // size on 32bit platforms
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ func pkgFilenames(dir string, includeTest bool) ([]string, error) {
|
||||||
return filenames, nil
|
return filenames, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func walkPkgDirs(dir string, pkgh func(dir string, filenames []string), errh func(args ...interface{})) {
|
func walkPkgDirs(dir string, pkgh func(dir string, filenames []string), errh func(args ...any)) {
|
||||||
w := walker{pkgh, errh}
|
w := walker{pkgh, errh}
|
||||||
w.walk(dir)
|
w.walk(dir)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ func (check *Checker) suspendedCall(keyword string, call syntax.Expr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// goVal returns the Go value for val, or nil.
|
// goVal returns the Go value for val, or nil.
|
||||||
func goVal(val constant.Value) interface{} {
|
func goVal(val constant.Value) any {
|
||||||
// val should exist, but be conservative and check
|
// val should exist, but be conservative and check
|
||||||
if val == nil {
|
if val == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -226,7 +226,7 @@ func goVal(val constant.Value) interface{} {
|
||||||
// types we need to also check the value's types (e.g., byte(1) vs myByte(1))
|
// types we need to also check the value's types (e.g., byte(1) vs myByte(1))
|
||||||
// when the switch expression is of interface type.
|
// when the switch expression is of interface type.
|
||||||
type (
|
type (
|
||||||
valueMap map[interface{}][]valueType // underlying Go value -> valueType
|
valueMap map[any][]valueType // underlying Go value -> valueType
|
||||||
valueType struct {
|
valueType struct {
|
||||||
pos syntax.Pos
|
pos syntax.Pos
|
||||||
typ Type
|
typ Type
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func (u *unifier) unify(x, y Type, mode unifyMode) bool {
|
||||||
return u.nify(x, y, mode, nil)
|
return u.nify(x, y, mode, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *unifier) tracef(format string, args ...interface{}) {
|
func (u *unifier) tracef(format string, args ...any) {
|
||||||
fmt.Println(strings.Repeat(". ", u.depth) + sprintf(nil, true, format, args...))
|
fmt.Println(strings.Repeat(". ", u.depth) + sprintf(nil, true, format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func (check *Checker) allowVersion(want goVersion) bool {
|
||||||
|
|
||||||
// verifyVersionf is like allowVersion but also accepts a format string and arguments
|
// verifyVersionf is like allowVersion but also accepts a format string and arguments
|
||||||
// which are used to report a version error if allowVersion returns false.
|
// which are used to report a version error if allowVersion returns false.
|
||||||
func (check *Checker) verifyVersionf(at poser, v goVersion, format string, args ...interface{}) bool {
|
func (check *Checker) verifyVersionf(at poser, v goVersion, format string, args ...any) bool {
|
||||||
if !check.allowVersion(v) {
|
if !check.allowVersion(v) {
|
||||||
check.versionErrorf(at, v, format, args...)
|
check.versionErrorf(at, v, format, args...)
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,14 @@ func Exit(code int) {
|
||||||
os.Exit(code)
|
os.Exit(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
func dbgtrace(vlevel int, s string, a ...interface{}) {
|
func dbgtrace(vlevel int, s string, a ...any) {
|
||||||
if *verbflag >= vlevel {
|
if *verbflag >= vlevel {
|
||||||
fmt.Printf(s, a...)
|
fmt.Printf(s, a...)
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func warn(s string, a ...interface{}) {
|
func warn(s string, a ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "warning: ")
|
fmt.Fprintf(os.Stderr, "warning: ")
|
||||||
fmt.Fprintf(os.Stderr, s, a...)
|
fmt.Fprintf(os.Stderr, s, a...)
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
@ -58,7 +58,7 @@ func warn(s string, a ...interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fatal(s string, a ...interface{}) {
|
func fatal(s string, a ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "error: ")
|
fmt.Fprintf(os.Stderr, "error: ")
|
||||||
fmt.Fprintf(os.Stderr, s, a...)
|
fmt.Fprintf(os.Stderr, s, a...)
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
|
||||||
4
src/cmd/dist/test.go
vendored
4
src/cmd/dist/test.go
vendored
|
|
@ -1108,7 +1108,7 @@ func (t *tester) registerTest(heading string, test *goTest, opts ...registerTest
|
||||||
// dirCmd constructs a Cmd intended to be run in the foreground.
|
// dirCmd constructs a Cmd intended to be run in the foreground.
|
||||||
// The command will be run in dir, and Stdout and Stderr will go to os.Stdout
|
// The command will be run in dir, and Stdout and Stderr will go to os.Stdout
|
||||||
// and os.Stderr.
|
// and os.Stderr.
|
||||||
func (t *tester) dirCmd(dir string, cmdline ...interface{}) *exec.Cmd {
|
func (t *tester) dirCmd(dir string, cmdline ...any) *exec.Cmd {
|
||||||
bin, args := flattenCmdline(cmdline)
|
bin, args := flattenCmdline(cmdline)
|
||||||
cmd := exec.Command(bin, args...)
|
cmd := exec.Command(bin, args...)
|
||||||
if filepath.IsAbs(dir) {
|
if filepath.IsAbs(dir) {
|
||||||
|
|
@ -1126,7 +1126,7 @@ func (t *tester) dirCmd(dir string, cmdline ...interface{}) *exec.Cmd {
|
||||||
|
|
||||||
// flattenCmdline flattens a mixture of string and []string as single list
|
// flattenCmdline flattens a mixture of string and []string as single list
|
||||||
// and then interprets it as a command line: first element is binary, then args.
|
// and then interprets it as a command line: first element is binary, then args.
|
||||||
func flattenCmdline(cmdline []interface{}) (bin string, args []string) {
|
func flattenCmdline(cmdline []any) (bin string, args []string) {
|
||||||
var list []string
|
var list []string
|
||||||
for _, x := range cmdline {
|
for _, x := range cmdline {
|
||||||
switch x := x.(type) {
|
switch x := x.(type) {
|
||||||
|
|
|
||||||
8
src/cmd/dist/util.go
vendored
8
src/cmd/dist/util.go
vendored
|
|
@ -21,7 +21,7 @@ import (
|
||||||
|
|
||||||
// pathf is fmt.Sprintf for generating paths
|
// pathf is fmt.Sprintf for generating paths
|
||||||
// (on windows it turns / into \ after the printf).
|
// (on windows it turns / into \ after the printf).
|
||||||
func pathf(format string, args ...interface{}) string {
|
func pathf(format string, args ...any) string {
|
||||||
return filepath.Clean(fmt.Sprintf(format, args...))
|
return filepath.Clean(fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,7 +324,7 @@ func xworkdir() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fatalf prints an error message to standard error and exits.
|
// fatalf prints an error message to standard error and exits.
|
||||||
func fatalf(format string, args ...interface{}) {
|
func fatalf(format string, args ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "go tool dist: %s\n", fmt.Sprintf(format, args...))
|
fmt.Fprintf(os.Stderr, "go tool dist: %s\n", fmt.Sprintf(format, args...))
|
||||||
|
|
||||||
dieOnce.Do(func() { close(dying) })
|
dieOnce.Do(func() { close(dying) })
|
||||||
|
|
@ -353,12 +353,12 @@ func xatexit(f func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// xprintf prints a message to standard output.
|
// xprintf prints a message to standard output.
|
||||||
func xprintf(format string, args ...interface{}) {
|
func xprintf(format string, args ...any) {
|
||||||
fmt.Printf(format, args...)
|
fmt.Printf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// errprintf prints a message to standard output.
|
// errprintf prints a message to standard output.
|
||||||
func errprintf(format string, args ...interface{}) {
|
func errprintf(format string, args ...any) {
|
||||||
fmt.Fprintf(os.Stderr, format, args...)
|
fmt.Fprintf(os.Stderr, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ func (e *invalidImportError) Unwrap() error {
|
||||||
// 1.20, preventing unnecessary go.sum churn and network access in those
|
// 1.20, preventing unnecessary go.sum churn and network access in those
|
||||||
// modules.
|
// modules.
|
||||||
func importFromModules(loaderstate *State, ctx context.Context, path string, rs *Requirements, mg *ModuleGraph, skipModFile bool) (m module.Version, modroot, dir string, altMods []module.Version, err error) {
|
func importFromModules(loaderstate *State, ctx context.Context, path string, rs *Requirements, mg *ModuleGraph, skipModFile bool) (m module.Version, modroot, dir string, altMods []module.Version, err error) {
|
||||||
invalidf := func(format string, args ...interface{}) (module.Version, string, string, []module.Version, error) {
|
invalidf := func(format string, args ...any) (module.Version, string, string, []module.Version, error) {
|
||||||
return module.Version{}, "", "", nil, &invalidImportError{
|
return module.Version{}, "", "", nil, &invalidImportError{
|
||||||
importPath: path,
|
importPath: path,
|
||||||
err: fmt.Errorf(format, args...),
|
err: fmt.Errorf(format, args...),
|
||||||
|
|
|
||||||
|
|
@ -145,14 +145,14 @@ func (r *CovDataReader) Visit() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *CovDataReader) verb(vlevel int, s string, a ...interface{}) {
|
func (r *CovDataReader) verb(vlevel int, s string, a ...any) {
|
||||||
if r.verbosityLevel >= vlevel {
|
if r.verbosityLevel >= vlevel {
|
||||||
fmt.Fprintf(os.Stderr, s, a...)
|
fmt.Fprintf(os.Stderr, s, a...)
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *CovDataReader) warn(s string, a ...interface{}) {
|
func (r *CovDataReader) warn(s string, a ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "warning: ")
|
fmt.Fprintf(os.Stderr, "warning: ")
|
||||||
fmt.Fprintf(os.Stderr, s, a...)
|
fmt.Fprintf(os.Stderr, s, a...)
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
@ -161,7 +161,7 @@ func (r *CovDataReader) warn(s string, a ...interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *CovDataReader) fatal(s string, a ...interface{}) error {
|
func (r *CovDataReader) fatal(s string, a ...any) error {
|
||||||
if r.err != nil {
|
if r.err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@ const AbstractFuncSuffix = "$abstract"
|
||||||
var logDwarf bool
|
var logDwarf bool
|
||||||
|
|
||||||
// Sym represents a symbol.
|
// Sym represents a symbol.
|
||||||
type Sym interface {
|
type Sym any
|
||||||
}
|
|
||||||
|
|
||||||
// A Var represents a local variable or a function parameter.
|
// A Var represents a local variable or a function parameter.
|
||||||
type Var struct {
|
type Var struct {
|
||||||
|
|
@ -194,16 +193,16 @@ type Context interface {
|
||||||
Size(s Sym) int64
|
Size(s Sym) int64
|
||||||
AddInt(s Sym, size int, i int64)
|
AddInt(s Sym, size int, i int64)
|
||||||
AddBytes(s Sym, b []byte)
|
AddBytes(s Sym, b []byte)
|
||||||
AddAddress(s Sym, t interface{}, ofs int64)
|
AddAddress(s Sym, t any, ofs int64)
|
||||||
AddCURelativeAddress(s Sym, t interface{}, ofs int64)
|
AddCURelativeAddress(s Sym, t any, ofs int64)
|
||||||
AddSectionOffset(s Sym, size int, t interface{}, ofs int64)
|
AddSectionOffset(s Sym, size int, t any, ofs int64)
|
||||||
AddDWARFAddrSectionOffset(s Sym, t interface{}, ofs int64)
|
AddDWARFAddrSectionOffset(s Sym, t any, ofs int64)
|
||||||
AddIndirectTextRef(s Sym, t interface{})
|
AddIndirectTextRef(s Sym, t any)
|
||||||
CurrentOffset(s Sym) int64
|
CurrentOffset(s Sym) int64
|
||||||
RecordDclReference(from Sym, to Sym, dclIdx int, inlIndex int)
|
RecordDclReference(from Sym, to Sym, dclIdx int, inlIndex int)
|
||||||
RecordChildDieOffsets(s Sym, vars []*Var, offsets []int32)
|
RecordChildDieOffsets(s Sym, vars []*Var, offsets []int32)
|
||||||
AddString(s Sym, v string)
|
AddString(s Sym, v string)
|
||||||
Logf(format string, args ...interface{})
|
Logf(format string, args ...any)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendUleb128 appends v to b using DWARF's unsigned LEB128 encoding.
|
// AppendUleb128 appends v to b using DWARF's unsigned LEB128 encoding.
|
||||||
|
|
@ -874,7 +873,7 @@ type DWAttr struct {
|
||||||
Atr uint16 // DW_AT_
|
Atr uint16 // DW_AT_
|
||||||
Cls uint8 // DW_CLS_
|
Cls uint8 // DW_CLS_
|
||||||
Value int64
|
Value int64
|
||||||
Data interface{}
|
Data any
|
||||||
}
|
}
|
||||||
|
|
||||||
// DWDie represents a DWARF debug info entry.
|
// DWDie represents a DWARF debug info entry.
|
||||||
|
|
@ -886,7 +885,7 @@ type DWDie struct {
|
||||||
Sym Sym
|
Sym Sym
|
||||||
}
|
}
|
||||||
|
|
||||||
func putattr(ctxt Context, s Sym, abbrev int, form int, cls int, value int64, data interface{}) error {
|
func putattr(ctxt Context, s Sym, abbrev int, form int, cls int, value int64, data any) error {
|
||||||
switch form {
|
switch form {
|
||||||
case DW_FORM_addr: // address
|
case DW_FORM_addr: // address
|
||||||
// Allow nil addresses for DW_AT_go_runtime_type.
|
// Allow nil addresses for DW_AT_go_runtime_type.
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ func (r *LoadCmdReader) Next() (LoadCmd, error) {
|
||||||
return cmd, nil
|
return cmd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r LoadCmdReader) ReadAt(offset int64, data interface{}) error {
|
func (r LoadCmdReader) ReadAt(offset int64, data any) error {
|
||||||
if _, err := r.f.Seek(r.offset+offset, 0); err != nil {
|
if _, err := r.f.Seek(r.offset+offset, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +117,7 @@ func NewLoadCmdUpdater(f io.ReadWriteSeeker, order binary.ByteOrder, nextOffset
|
||||||
return LoadCmdUpdater{NewLoadCmdReader(f, order, nextOffset)}
|
return LoadCmdUpdater{NewLoadCmdReader(f, order, nextOffset)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u LoadCmdUpdater) WriteAt(offset int64, data interface{}) error {
|
func (u LoadCmdUpdater) WriteAt(offset int64, data any) error {
|
||||||
if _, err := u.f.Seek(u.offset+offset, 0); err != nil {
|
if _, err := u.f.Seek(u.offset+offset, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ func (c dwCtxt) AddString(s dwarf.Sym, v string) {
|
||||||
ls.WriteString(c.Link, ls.Size, len(v), v)
|
ls.WriteString(c.Link, ls.Size, len(v), v)
|
||||||
ls.WriteInt(c.Link, ls.Size, 1, 0)
|
ls.WriteInt(c.Link, ls.Size, 1, 0)
|
||||||
}
|
}
|
||||||
func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
|
func (c dwCtxt) AddAddress(s dwarf.Sym, data any, value int64) {
|
||||||
ls := s.(*LSym)
|
ls := s.(*LSym)
|
||||||
size := c.PtrSize()
|
size := c.PtrSize()
|
||||||
if data != nil {
|
if data != nil {
|
||||||
|
|
@ -241,15 +241,15 @@ func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
|
||||||
ls.WriteInt(c.Link, ls.Size, size, value)
|
ls.WriteInt(c.Link, ls.Size, size, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (c dwCtxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64) {
|
func (c dwCtxt) AddCURelativeAddress(s dwarf.Sym, data any, value int64) {
|
||||||
ls := s.(*LSym)
|
ls := s.(*LSym)
|
||||||
rsym := data.(*LSym)
|
rsym := data.(*LSym)
|
||||||
ls.WriteCURelativeAddr(c.Link, ls.Size, rsym, value)
|
ls.WriteCURelativeAddr(c.Link, ls.Size, rsym, value)
|
||||||
}
|
}
|
||||||
func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) {
|
func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t any, ofs int64) {
|
||||||
panic("should be used only in the linker")
|
panic("should be used only in the linker")
|
||||||
}
|
}
|
||||||
func (c dwCtxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64) {
|
func (c dwCtxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t any, ofs int64) {
|
||||||
size := 4
|
size := 4
|
||||||
if isDwarf64(c.Link) {
|
if isDwarf64(c.Link) {
|
||||||
size = 8
|
size = 8
|
||||||
|
|
@ -284,11 +284,11 @@ func (c dwCtxt) RecordChildDieOffsets(s dwarf.Sym, vars []*dwarf.Var, offsets []
|
||||||
c.Link.DwFixups.RegisterChildDIEOffsets(ls, vars, offsets)
|
c.Link.DwFixups.RegisterChildDIEOffsets(ls, vars, offsets)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwCtxt) Logf(format string, args ...interface{}) {
|
func (c dwCtxt) Logf(format string, args ...any) {
|
||||||
c.Link.Logf(format, args...)
|
c.Link.Logf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwCtxt) AddIndirectTextRef(s dwarf.Sym, t interface{}) {
|
func (c dwCtxt) AddIndirectTextRef(s dwarf.Sym, t any) {
|
||||||
ls := s.(*LSym)
|
ls := s.(*LSym)
|
||||||
tsym := t.(*LSym)
|
tsym := t.(*LSym)
|
||||||
// Note the doubling below -- DwTextCount is an estimate and
|
// Note the doubling below -- DwTextCount is an estimate and
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ type Addr struct {
|
||||||
// for TYPE_FCONST, a float64
|
// for TYPE_FCONST, a float64
|
||||||
// for TYPE_BRANCH, a *Prog (optional)
|
// for TYPE_BRANCH, a *Prog (optional)
|
||||||
// for TYPE_TEXTSIZE, an int32 (optional)
|
// for TYPE_TEXTSIZE, an int32 (optional)
|
||||||
Val interface{}
|
Val any
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddrName int8
|
type AddrName int8
|
||||||
|
|
@ -464,7 +464,7 @@ type LSym struct {
|
||||||
P []byte
|
P []byte
|
||||||
R []Reloc
|
R []Reloc
|
||||||
|
|
||||||
Extra *interface{} // *FuncInfo, *VarInfo, *FileInfo, *TypeInfo, or *ItabInfo, if present
|
Extra *any // *FuncInfo, *VarInfo, *FileInfo, *TypeInfo, or *ItabInfo, if present
|
||||||
|
|
||||||
Pkg string
|
Pkg string
|
||||||
PkgIdx int32
|
PkgIdx int32
|
||||||
|
|
@ -523,7 +523,7 @@ func (s *LSym) NewFuncInfo() *FuncInfo {
|
||||||
panic(fmt.Sprintf("invalid use of LSym - NewFuncInfo with Extra of type %T", *s.Extra))
|
panic(fmt.Sprintf("invalid use of LSym - NewFuncInfo with Extra of type %T", *s.Extra))
|
||||||
}
|
}
|
||||||
f := new(FuncInfo)
|
f := new(FuncInfo)
|
||||||
s.Extra = new(interface{})
|
s.Extra = new(any)
|
||||||
*s.Extra = f
|
*s.Extra = f
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
@ -547,7 +547,7 @@ func (s *LSym) NewVarInfo() *VarInfo {
|
||||||
panic(fmt.Sprintf("invalid use of LSym - NewVarInfo with Extra of type %T", *s.Extra))
|
panic(fmt.Sprintf("invalid use of LSym - NewVarInfo with Extra of type %T", *s.Extra))
|
||||||
}
|
}
|
||||||
f := new(VarInfo)
|
f := new(VarInfo)
|
||||||
s.Extra = new(interface{})
|
s.Extra = new(any)
|
||||||
*s.Extra = f
|
*s.Extra = f
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
@ -574,7 +574,7 @@ func (s *LSym) NewFileInfo() *FileInfo {
|
||||||
panic(fmt.Sprintf("invalid use of LSym - NewFileInfo with Extra of type %T", *s.Extra))
|
panic(fmt.Sprintf("invalid use of LSym - NewFileInfo with Extra of type %T", *s.Extra))
|
||||||
}
|
}
|
||||||
f := new(FileInfo)
|
f := new(FileInfo)
|
||||||
s.Extra = new(interface{})
|
s.Extra = new(any)
|
||||||
*s.Extra = f
|
*s.Extra = f
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
@ -591,7 +591,7 @@ func (s *LSym) File() *FileInfo {
|
||||||
// A TypeInfo contains information for a symbol
|
// A TypeInfo contains information for a symbol
|
||||||
// that contains a runtime._type.
|
// that contains a runtime._type.
|
||||||
type TypeInfo struct {
|
type TypeInfo struct {
|
||||||
Type interface{} // a *cmd/compile/internal/types.Type
|
Type any // a *cmd/compile/internal/types.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LSym) NewTypeInfo() *TypeInfo {
|
func (s *LSym) NewTypeInfo() *TypeInfo {
|
||||||
|
|
@ -599,7 +599,7 @@ func (s *LSym) NewTypeInfo() *TypeInfo {
|
||||||
panic(fmt.Sprintf("invalid use of LSym - NewTypeInfo with Extra of type %T", *s.Extra))
|
panic(fmt.Sprintf("invalid use of LSym - NewTypeInfo with Extra of type %T", *s.Extra))
|
||||||
}
|
}
|
||||||
t := new(TypeInfo)
|
t := new(TypeInfo)
|
||||||
s.Extra = new(interface{})
|
s.Extra = new(any)
|
||||||
*s.Extra = t
|
*s.Extra = t
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
@ -616,7 +616,7 @@ func (s *LSym) TypeInfo() *TypeInfo {
|
||||||
// An ItabInfo contains information for a symbol
|
// An ItabInfo contains information for a symbol
|
||||||
// that contains a runtime.itab.
|
// that contains a runtime.itab.
|
||||||
type ItabInfo struct {
|
type ItabInfo struct {
|
||||||
Type interface{} // a *cmd/compile/internal/types.Type
|
Type any // a *cmd/compile/internal/types.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LSym) NewItabInfo() *ItabInfo {
|
func (s *LSym) NewItabInfo() *ItabInfo {
|
||||||
|
|
@ -624,7 +624,7 @@ func (s *LSym) NewItabInfo() *ItabInfo {
|
||||||
panic(fmt.Sprintf("invalid use of LSym - NewItabInfo with Extra of type %T", *s.Extra))
|
panic(fmt.Sprintf("invalid use of LSym - NewItabInfo with Extra of type %T", *s.Extra))
|
||||||
}
|
}
|
||||||
t := new(ItabInfo)
|
t := new(ItabInfo)
|
||||||
s.Extra = new(interface{})
|
s.Extra = new(any)
|
||||||
*s.Extra = t
|
*s.Extra = t
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
@ -1178,7 +1178,7 @@ type Link struct {
|
||||||
DwFixups *DwarfFixupTable
|
DwFixups *DwarfFixupTable
|
||||||
DwTextCount int
|
DwTextCount int
|
||||||
Imports []goobj.ImportedPkg
|
Imports []goobj.ImportedPkg
|
||||||
DiagFunc func(string, ...interface{})
|
DiagFunc func(string, ...any)
|
||||||
DiagFlush func()
|
DiagFlush func()
|
||||||
DebugInfo func(ctxt *Link, fn *LSym, info *LSym, curfn Func) ([]dwarf.Scope, dwarf.InlCalls)
|
DebugInfo func(ctxt *Link, fn *LSym, info *LSym, curfn Func) ([]dwarf.Scope, dwarf.InlCalls)
|
||||||
GenAbstractFunc func(fn *LSym)
|
GenAbstractFunc func(fn *LSym)
|
||||||
|
|
@ -1223,12 +1223,12 @@ func _(ctxt *Link) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctxt *Link) Diag(format string, args ...interface{}) {
|
func (ctxt *Link) Diag(format string, args ...any) {
|
||||||
ctxt.Errors++
|
ctxt.Errors++
|
||||||
ctxt.DiagFunc(format, args...)
|
ctxt.DiagFunc(format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctxt *Link) Logf(format string, args ...interface{}) {
|
func (ctxt *Link) Logf(format string, args ...any) {
|
||||||
fmt.Fprintf(ctxt.Bso, format, args...)
|
fmt.Fprintf(ctxt.Bso, format, args...)
|
||||||
ctxt.Bso.Flush()
|
ctxt.Bso.Flush()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1340,7 +1340,7 @@ func opset(a, b0 obj.As) {
|
||||||
|
|
||||||
func buildop(ctxt *obj.Link) {
|
func buildop(ctxt *obj.Link) {
|
||||||
if ctxt.DiagFunc == nil {
|
if ctxt.DiagFunc == nil {
|
||||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
ctxt.DiagFunc = func(format string, args ...any) {
|
||||||
log.Printf(format, args...)
|
log.Printf(format, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import (
|
||||||
//
|
//
|
||||||
// where func is the function, val is the current value, p is the instruction being
|
// where func is the function, val is the current value, p is the instruction being
|
||||||
// considered, and arg can be used to further parameterize valfunc.
|
// considered, and arg can be used to further parameterize valfunc.
|
||||||
func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym, int32, *Prog, int32, interface{}) int32, arg interface{}) *LSym {
|
func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym, int32, *Prog, int32, any) int32, arg any) *LSym {
|
||||||
dbg := desc == ctxt.Debugpcln
|
dbg := desc == ctxt.Debugpcln
|
||||||
dst := []byte{}
|
dst := []byte{}
|
||||||
sym := &LSym{
|
sym := &LSym{
|
||||||
|
|
@ -138,7 +138,7 @@ func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym,
|
||||||
// or the line number (arg == 1) to use at p.
|
// or the line number (arg == 1) to use at p.
|
||||||
// Because p.Pos applies to p, phase == 0 (before p)
|
// Because p.Pos applies to p, phase == 0 (before p)
|
||||||
// takes care of the update.
|
// takes care of the update.
|
||||||
func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
|
func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
|
||||||
if p.As == ATEXT || p.As == ANOP || p.Pos.Line() == 0 || phase == 1 {
|
if p.As == ATEXT || p.As == ANOP || p.Pos.Line() == 0 || phase == 1 {
|
||||||
return oldval
|
return oldval
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +198,7 @@ func (s *pcinlineState) setParentPC(ctxt *Link, globalIndex int, pc int32) {
|
||||||
// pctoinline computes the index into the local inlining tree to use at p.
|
// pctoinline computes the index into the local inlining tree to use at p.
|
||||||
// If p is not the result of inlining, pctoinline returns -1. Because p.Pos
|
// If p is not the result of inlining, pctoinline returns -1. Because p.Pos
|
||||||
// applies to p, phase == 0 (before p) takes care of the update.
|
// applies to p, phase == 0 (before p) takes care of the update.
|
||||||
func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
|
func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
|
||||||
if phase == 1 {
|
if phase == 1 {
|
||||||
return oldval
|
return oldval
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +224,7 @@ func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog,
|
||||||
// It is oldval plus any adjustment made by p itself.
|
// It is oldval plus any adjustment made by p itself.
|
||||||
// The adjustment by p takes effect only after p, so we
|
// The adjustment by p takes effect only after p, so we
|
||||||
// apply the change during phase == 1.
|
// apply the change during phase == 1.
|
||||||
func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
|
func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
|
||||||
if oldval == -1 { // starting
|
if oldval == -1 { // starting
|
||||||
oldval = 0
|
oldval = 0
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +245,7 @@ func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg in
|
||||||
// non-PCDATA instructions.
|
// non-PCDATA instructions.
|
||||||
// Since PCDATA instructions have no width in the final code,
|
// Since PCDATA instructions have no width in the final code,
|
||||||
// it does not matter which phase we use for the update.
|
// it does not matter which phase we use for the update.
|
||||||
func pctopcdata(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
|
func pctopcdata(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
|
||||||
if phase == 0 || p.As != APCDATA || p.From.Offset != int64(arg.(uint32)) {
|
if phase == 0 || p.As != APCDATA || p.From.Offset != int64(arg.(uint32)) {
|
||||||
return oldval
|
return oldval
|
||||||
}
|
}
|
||||||
|
|
@ -337,7 +337,7 @@ func linkpcln(ctxt *Link, cursym *LSym) {
|
||||||
Attribute: AttrContentAddressable | AttrPcdata,
|
Attribute: AttrContentAddressable | AttrPcdata,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pcln.Pcdata[i] = funcpctab(ctxt, cursym, "pctopcdata", pctopcdata, interface{}(uint32(i)))
|
pcln.Pcdata[i] = funcpctab(ctxt, cursym, "pctopcdata", pctopcdata, any(uint32(i)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ func TestAddrClassifier(t *testing.T) {
|
||||||
}
|
}
|
||||||
tsts := [...]struct {
|
tsts := [...]struct {
|
||||||
arg obj.Addr
|
arg obj.Addr
|
||||||
output interface{}
|
output any
|
||||||
}{
|
}{
|
||||||
// Supported register type args
|
// Supported register type args
|
||||||
{obj.Addr{Type: obj.TYPE_REG, Reg: REG_R1}, C_REG},
|
{obj.Addr{Type: obj.TYPE_REG, Reg: REG_R1}, C_REG},
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func TestSizeof(t *testing.T) {
|
||||||
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
const _64bit = unsafe.Sizeof(uintptr(0)) == 8
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
val interface{} // type as a value
|
val any // type as a value
|
||||||
_32bit uintptr // size on 32bit platforms
|
_32bit uintptr // size on 32bit platforms
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ var buildID string // filled in by linker
|
||||||
type versionFlag struct{}
|
type versionFlag struct{}
|
||||||
|
|
||||||
func (versionFlag) IsBoolFlag() bool { return true }
|
func (versionFlag) IsBoolFlag() bool { return true }
|
||||||
func (versionFlag) Get() interface{} { return nil }
|
func (versionFlag) Get() any { return nil }
|
||||||
func (versionFlag) String() string { return "" }
|
func (versionFlag) String() string { return "" }
|
||||||
func (versionFlag) Set(s string) error {
|
func (versionFlag) Set(s string) error {
|
||||||
name := os.Args[0]
|
name := os.Args[0]
|
||||||
|
|
@ -148,7 +148,7 @@ func (c *count) Set(s string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *count) Get() interface{} {
|
func (c *count) Get() any {
|
||||||
return int(*c)
|
return int(*c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ type debugField struct {
|
||||||
name string
|
name string
|
||||||
help string
|
help string
|
||||||
concurrentOk bool // true if this field/flag is compatible with concurrent compilation
|
concurrentOk bool // true if this field/flag is compatible with concurrent compilation
|
||||||
val interface{} // *int or *string
|
val any // *int or *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type DebugFlag struct {
|
type DebugFlag struct {
|
||||||
|
|
@ -234,7 +234,7 @@ type DebugSSA func(phase, flag string, val int, valString string) string
|
||||||
//
|
//
|
||||||
// If debugSSA is non-nil, any debug flags of the form ssa/... will be
|
// If debugSSA is non-nil, any debug flags of the form ssa/... will be
|
||||||
// passed to debugSSA for processing.
|
// passed to debugSSA for processing.
|
||||||
func NewDebugFlag(debug interface{}, debugSSA DebugSSA) *DebugFlag {
|
func NewDebugFlag(debug any, debugSSA DebugSSA) *DebugFlag {
|
||||||
flag := &DebugFlag{
|
flag := &DebugFlag{
|
||||||
tab: make(map[string]debugField),
|
tab: make(map[string]debugField),
|
||||||
debugSSA: debugSSA,
|
debugSSA: debugSSA,
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ func (c dwctxt) AddString(s dwarf.Sym, v string) {
|
||||||
dsu.Addstring(v)
|
dsu.Addstring(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
|
func (c dwctxt) AddAddress(s dwarf.Sym, data any, value int64) {
|
||||||
ds := loader.Sym(s.(dwSym))
|
ds := loader.Sym(s.(dwSym))
|
||||||
dsu := c.ldr.MakeSymbolUpdater(ds)
|
dsu := c.ldr.MakeSymbolUpdater(ds)
|
||||||
if value != 0 {
|
if value != 0 {
|
||||||
|
|
@ -110,7 +110,7 @@ func (c dwctxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
|
||||||
dsu.AddAddrPlus(c.arch, tgtds, value)
|
dsu.AddAddrPlus(c.arch, tgtds, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64) {
|
func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data any, value int64) {
|
||||||
ds := loader.Sym(s.(dwSym))
|
ds := loader.Sym(s.(dwSym))
|
||||||
dsu := c.ldr.MakeSymbolUpdater(ds)
|
dsu := c.ldr.MakeSymbolUpdater(ds)
|
||||||
if value != 0 {
|
if value != 0 {
|
||||||
|
|
@ -120,7 +120,7 @@ func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64)
|
||||||
dsu.AddCURelativeAddrPlus(c.arch, tgtds, value)
|
dsu.AddCURelativeAddrPlus(c.arch, tgtds, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) {
|
func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t any, ofs int64) {
|
||||||
ds := loader.Sym(s.(dwSym))
|
ds := loader.Sym(s.(dwSym))
|
||||||
dsu := c.ldr.MakeSymbolUpdater(ds)
|
dsu := c.ldr.MakeSymbolUpdater(ds)
|
||||||
tds := loader.Sym(t.(dwSym))
|
tds := loader.Sym(t.(dwSym))
|
||||||
|
|
@ -132,7 +132,7 @@ func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64
|
||||||
dsu.AddSymRef(c.arch, tds, ofs, objabi.R_ADDROFF, size)
|
dsu.AddSymRef(c.arch, tds, ofs, objabi.R_ADDROFF, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64) {
|
func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t any, ofs int64) {
|
||||||
size := 4
|
size := 4
|
||||||
if isDwarf64(c.linkctxt) {
|
if isDwarf64(c.linkctxt) {
|
||||||
size = 8
|
size = 8
|
||||||
|
|
@ -148,14 +148,14 @@ func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64)
|
||||||
dsu.AddSymRef(c.arch, tds, ofs, objabi.R_DWARFSECREF, size)
|
dsu.AddSymRef(c.arch, tds, ofs, objabi.R_DWARFSECREF, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) AddIndirectTextRef(s dwarf.Sym, t interface{}) {
|
func (c dwctxt) AddIndirectTextRef(s dwarf.Sym, t any) {
|
||||||
ds := loader.Sym(s.(dwSym))
|
ds := loader.Sym(s.(dwSym))
|
||||||
dsu := c.ldr.MakeSymbolUpdater(ds)
|
dsu := c.ldr.MakeSymbolUpdater(ds)
|
||||||
tds := loader.Sym(t.(dwSym))
|
tds := loader.Sym(t.(dwSym))
|
||||||
dsu.AddSymRef(c.arch, tds, 0, objabi.R_DWTXTADDR_U4, 4)
|
dsu.AddSymRef(c.arch, tds, 0, objabi.R_DWTXTADDR_U4, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dwctxt) Logf(format string, args ...interface{}) {
|
func (c dwctxt) Logf(format string, args ...any) {
|
||||||
c.linkctxt.Logf(format, args...)
|
c.linkctxt.Logf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ var dwtypes dwarf.DWDie
|
||||||
// up all attrs in a single large table, then store indices into the
|
// up all attrs in a single large table, then store indices into the
|
||||||
// table in the DIE. This would allow us to common up storage for
|
// table in the DIE. This would allow us to common up storage for
|
||||||
// attributes that are shared by many DIEs (ex: byte size of N).
|
// attributes that are shared by many DIEs (ex: byte size of N).
|
||||||
func newattr(die *dwarf.DWDie, attr uint16, cls int, value int64, data interface{}) {
|
func newattr(die *dwarf.DWDie, attr uint16, cls int, value int64, data any) {
|
||||||
a := new(dwarf.DWAttr)
|
a := new(dwarf.DWAttr)
|
||||||
a.Link = die.Attr
|
a.Link = die.Attr
|
||||||
die.Attr = a
|
die.Attr = a
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ type cgodata struct {
|
||||||
directives [][]string
|
directives [][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctxt *Link) Logf(format string, args ...interface{}) {
|
func (ctxt *Link) Logf(format string, args ...any) {
|
||||||
fmt.Fprintf(ctxt.Bso, format, args...)
|
fmt.Fprintf(ctxt.Bso, format, args...)
|
||||||
ctxt.Bso.Flush()
|
ctxt.Bso.Flush()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ func machoUpdateDwarfHeader(r *imacho.LoadCmdUpdater, compressedSects []*macho.S
|
||||||
return machoUpdateSections(*r, &seg, uint64(dwarfstart)-realdwarf.Offset, compressedSects)
|
return machoUpdateSections(*r, &seg, uint64(dwarfstart)-realdwarf.Offset, compressedSects)
|
||||||
}
|
}
|
||||||
|
|
||||||
func machoUpdateLoadCommand(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64, cmd interface{}, fields ...string) error {
|
func machoUpdateLoadCommand(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64, cmd any, fields ...string) error {
|
||||||
if err := r.ReadAt(0, cmd); err != nil {
|
if err := r.ReadAt(0, cmd); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func Exit(code int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exitf logs an error message then calls Exit(2).
|
// Exitf logs an error message then calls Exit(2).
|
||||||
func Exitf(format string, a ...interface{}) {
|
func Exitf(format string, a ...any) {
|
||||||
fmt.Fprintf(os.Stderr, os.Args[0]+": "+format+"\n", a...)
|
fmt.Fprintf(os.Stderr, os.Args[0]+": "+format+"\n", a...)
|
||||||
nerrors++
|
nerrors++
|
||||||
if *flagH {
|
if *flagH {
|
||||||
|
|
@ -60,7 +60,7 @@ func afterErrorAction() {
|
||||||
//
|
//
|
||||||
// Logging an error means that on exit cmd/link will delete any
|
// Logging an error means that on exit cmd/link will delete any
|
||||||
// output file and return a non-zero error code.
|
// output file and return a non-zero error code.
|
||||||
func Errorf(format string, args ...interface{}) {
|
func Errorf(format string, args ...any) {
|
||||||
format += "\n"
|
format += "\n"
|
||||||
fmt.Fprintf(os.Stderr, format, args...)
|
fmt.Fprintf(os.Stderr, format, args...)
|
||||||
afterErrorAction()
|
afterErrorAction()
|
||||||
|
|
@ -72,7 +72,7 @@ func Errorf(format string, args ...interface{}) {
|
||||||
//
|
//
|
||||||
// Logging an error means that on exit cmd/link will delete any
|
// Logging an error means that on exit cmd/link will delete any
|
||||||
// output file and return a non-zero error code.
|
// output file and return a non-zero error code.
|
||||||
func (ctxt *Link) Errorf(s loader.Sym, format string, args ...interface{}) {
|
func (ctxt *Link) Errorf(s loader.Sym, format string, args ...any) {
|
||||||
if ctxt.loader != nil {
|
if ctxt.loader != nil {
|
||||||
ctxt.loader.Errorf(s, format, args...)
|
ctxt.loader.Errorf(s, format, args...)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Type representing all XCOFF symbols.
|
// Type representing all XCOFF symbols.
|
||||||
type xcoffSym interface {
|
type xcoffSym any
|
||||||
}
|
|
||||||
|
|
||||||
// Symbol Table Entry
|
// Symbol Table Entry
|
||||||
type XcoffSymEnt64 struct {
|
type XcoffSymEnt64 struct {
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ func parseArmAttributes(e binary.ByteOrder, data []byte) (found bool, ehdrFlags
|
||||||
// object, and the returned ehdrFlags contains what this Load function computes.
|
// object, and the returned ehdrFlags contains what this Load function computes.
|
||||||
// TODO: find a better place for this logic.
|
// TODO: find a better place for this logic.
|
||||||
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string, initEhdrFlags uint32) (textp []loader.Sym, ehdrFlags uint32, err error) {
|
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string, initEhdrFlags uint32) (textp []loader.Sym, ehdrFlags uint32, err error) {
|
||||||
errorf := func(str string, args ...interface{}) ([]loader.Sym, uint32, error) {
|
errorf := func(str string, args ...any) ([]loader.Sym, uint32, error) {
|
||||||
return nil, 0, fmt.Errorf("loadelf: %s: %v", pn, fmt.Sprintf(str, args...))
|
return nil, 0, fmt.Errorf("loadelf: %s: %v", pn, fmt.Sprintf(str, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2821,7 +2821,7 @@ type ErrorReporter struct {
|
||||||
//
|
//
|
||||||
// Logging an error means that on exit cmd/link will delete any
|
// Logging an error means that on exit cmd/link will delete any
|
||||||
// output file and return a non-zero error code.
|
// output file and return a non-zero error code.
|
||||||
func (reporter *ErrorReporter) Errorf(s Sym, format string, args ...interface{}) {
|
func (reporter *ErrorReporter) Errorf(s Sym, format string, args ...any) {
|
||||||
if s != 0 && reporter.ldr.SymName(s) != "" {
|
if s != 0 && reporter.ldr.SymName(s) != "" {
|
||||||
// Note: Replace is needed here because symbol names might have % in them,
|
// Note: Replace is needed here because symbol names might have % in them,
|
||||||
// due to the use of LinkString for names of instantiating types.
|
// due to the use of LinkString for names of instantiating types.
|
||||||
|
|
@ -2840,7 +2840,7 @@ func (l *Loader) GetErrorReporter() *ErrorReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Errorf method logs an error message. See ErrorReporter.Errorf for details.
|
// Errorf method logs an error message. See ErrorReporter.Errorf for details.
|
||||||
func (l *Loader) Errorf(s Sym, format string, args ...interface{}) {
|
func (l *Loader) Errorf(s Sym, format string, args ...any) {
|
||||||
l.errorReporter.Errorf(s, format, args...)
|
l.errorReporter.Errorf(s, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,7 @@ func macholoadsym(m *ldMachoObj, symtab *ldMachoSymtab) int {
|
||||||
// Load the Mach-O file pn from f.
|
// Load the Mach-O file pn from f.
|
||||||
// Symbols are written into syms, and a slice of the text symbols is returned.
|
// Symbols are written into syms, and a slice of the text symbols is returned.
|
||||||
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
|
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
|
||||||
errorf := func(str string, args ...interface{}) ([]loader.Sym, error) {
|
errorf := func(str string, args ...any) ([]loader.Sym, error) {
|
||||||
return nil, fmt.Errorf("loadmacho: %v: %v", pn, fmt.Sprintf(str, args...))
|
return nil, fmt.Errorf("loadmacho: %v: %v", pn, fmt.Sprintf(str, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func (f *xcoffBiobuf) ReadAt(p []byte, off int64) (int, error) {
|
||||||
// loads the Xcoff file pn from f.
|
// loads the Xcoff file pn from f.
|
||||||
// Symbols are written into loader, and a slice of the text symbols is returned.
|
// Symbols are written into loader, and a slice of the text symbols is returned.
|
||||||
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
|
func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
|
||||||
errorf := func(str string, args ...interface{}) ([]loader.Sym, error) {
|
errorf := func(str string, args ...any) ([]loader.Sym, error) {
|
||||||
return nil, fmt.Errorf("loadxcoff: %v: %v", pn, fmt.Sprintf(str, args...))
|
return nil, fmt.Errorf("loadxcoff: %v: %v", pn, fmt.Sprintf(str, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ type Section struct {
|
||||||
Vaddr uint64
|
Vaddr uint64
|
||||||
Length uint64
|
Length uint64
|
||||||
Seg *Segment
|
Seg *Segment
|
||||||
Elfsect interface{} // an *ld.ElfShdr
|
Elfsect any // an *ld.ElfShdr
|
||||||
Reloff uint64
|
Reloff uint64
|
||||||
Rellen uint64
|
Rellen uint64
|
||||||
// Relcount is the number of *host* relocations applied to this section
|
// Relcount is the number of *host* relocations applied to this section
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import (
|
||||||
// of the API even if undocumented per Hyrum's Law.
|
// of the API even if undocumented per Hyrum's Law.
|
||||||
//
|
//
|
||||||
// ms must be a pointer to a non-nil interface.
|
// ms must be a pointer to a non-nil interface.
|
||||||
func NoExtraMethods(t *testing.T, ms interface{}, allowed ...string) {
|
func NoExtraMethods(t *testing.T, ms any, allowed ...string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
extraMethods, err := extraMethods(ms)
|
extraMethods, err := extraMethods(ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -33,7 +33,7 @@ func NoExtraMethods(t *testing.T, ms interface{}, allowed ...string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func extraMethods(ip interface{}) ([]string, error) {
|
func extraMethods(ip any) ([]string, error) {
|
||||||
v := reflect.ValueOf(ip)
|
v := reflect.ValueOf(ip)
|
||||||
if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Interface || v.Elem().IsNil() {
|
if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Interface || v.Elem().IsNil() {
|
||||||
return nil, fmt.Errorf("argument must be a pointer to a non-nil interface")
|
return nil, fmt.Errorf("argument must be a pointer to a non-nil interface")
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func TestScalarAliasing(t *testing.T) {
|
||||||
return x == x1 && y == y1
|
return x == x1 && y == y1
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, f := range map[string]interface{}{
|
for name, f := range map[string]any{
|
||||||
"Negate": func(v, x Scalar) bool {
|
"Negate": func(v, x Scalar) bool {
|
||||||
return checkAliasingOneArg((*Scalar).Negate, v, x)
|
return checkAliasingOneArg((*Scalar).Negate, v, x)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ func TestFIPSCertAlgs(t *testing.T) {
|
||||||
L2_I := fipsCert(t, "L2_I", fipsRSAKey(t, 1024), I_R1, fipsCertLeaf)
|
L2_I := fipsCert(t, "L2_I", fipsRSAKey(t, 1024), I_R1, fipsCertLeaf)
|
||||||
|
|
||||||
// client verifying server cert
|
// client verifying server cert
|
||||||
testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key interface{}, list [][]byte, ok bool) {
|
testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) {
|
||||||
clientConfig := testConfig.Clone()
|
clientConfig := testConfig.Clone()
|
||||||
clientConfig.RootCAs = pool
|
clientConfig.RootCAs = pool
|
||||||
clientConfig.InsecureSkipVerify = false
|
clientConfig.InsecureSkipVerify = false
|
||||||
|
|
@ -432,7 +432,7 @@ func TestFIPSCertAlgs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// server verifying client cert
|
// server verifying client cert
|
||||||
testClientCert := func(t *testing.T, desc string, pool *x509.CertPool, key interface{}, list [][]byte, ok bool) {
|
testClientCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) {
|
||||||
clientConfig := testConfig.Clone()
|
clientConfig := testConfig.Clone()
|
||||||
clientConfig.ServerName = "example.com"
|
clientConfig.ServerName = "example.com"
|
||||||
clientConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}}
|
clientConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}}
|
||||||
|
|
@ -574,11 +574,11 @@ type fipsCertificate struct {
|
||||||
parentOrg string
|
parentOrg string
|
||||||
der []byte
|
der []byte
|
||||||
cert *x509.Certificate
|
cert *x509.Certificate
|
||||||
key interface{}
|
key any
|
||||||
fipsOK bool
|
fipsOK bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificate, mode int) *fipsCertificate {
|
func fipsCert(t *testing.T, name string, key any, parent *fipsCertificate, mode int) *fipsCertificate {
|
||||||
org := name
|
org := name
|
||||||
parentOrg := ""
|
parentOrg := ""
|
||||||
if i := strings.Index(org, "_"); i >= 0 {
|
if i := strings.Index(org, "_"); i >= 0 {
|
||||||
|
|
@ -605,7 +605,7 @@ func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificat
|
||||||
}
|
}
|
||||||
|
|
||||||
var pcert *x509.Certificate
|
var pcert *x509.Certificate
|
||||||
var pkey interface{}
|
var pkey any
|
||||||
if parent != nil {
|
if parent != nil {
|
||||||
pcert = parent.cert
|
pcert = parent.cert
|
||||||
pkey = parent.key
|
pkey = parent.key
|
||||||
|
|
@ -614,7 +614,7 @@ func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificat
|
||||||
pkey = key
|
pkey = key
|
||||||
}
|
}
|
||||||
|
|
||||||
var pub interface{}
|
var pub any
|
||||||
var desc string
|
var desc string
|
||||||
switch k := key.(type) {
|
switch k := key.(type) {
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
|
|
|
||||||
|
|
@ -1274,7 +1274,7 @@ func TestDecoderOverflow(t *testing.T) {
|
||||||
0x12, 0xff, 0xff, 0x2, 0x2, 0x20, 0x0, 0xf8, 0x7f, 0xff, 0xff, 0xff,
|
0x12, 0xff, 0xff, 0x2, 0x2, 0x20, 0x0, 0xf8, 0x7f, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||||
}))
|
}))
|
||||||
var r interface{}
|
var r any
|
||||||
err := dec.Decode(r)
|
err := dec.Decode(r)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("expected an error")
|
t.Fatalf("expected an error")
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ func (check *Checker) newError(code Code) *error_ {
|
||||||
// Subsequent calls to addf provide additional information in the form of additional lines
|
// Subsequent calls to addf provide additional information in the form of additional lines
|
||||||
// in the error message (types2) or continuation errors identified by a tab-indented error
|
// in the error message (types2) or continuation errors identified by a tab-indented error
|
||||||
// message (go/types).
|
// message (go/types).
|
||||||
func (err *error_) addf(at positioner, format string, args ...interface{}) {
|
func (err *error_) addf(at positioner, format string, args ...any) {
|
||||||
err.desc = append(err.desc, errorDesc{at, err.check.sprintf(format, args...)})
|
err.desc = append(err.desc, errorDesc{at, err.check.sprintf(format, args...)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1198,7 +1198,7 @@ Error:
|
||||||
// represented as an integer (such as 1.0) it is returned as an integer value.
|
// represented as an integer (such as 1.0) it is returned as an integer value.
|
||||||
// This ensures that constants of different kind but equal value (such as
|
// This ensures that constants of different kind but equal value (such as
|
||||||
// 1.0 + 0i, 1.0, 1) result in the same value.
|
// 1.0 + 0i, 1.0, 1) result in the same value.
|
||||||
func keyVal(x constant.Value) interface{} {
|
func keyVal(x constant.Value) any {
|
||||||
switch x.Kind() {
|
switch x.Kind() {
|
||||||
case constant.Complex:
|
case constant.Complex:
|
||||||
f := constant.ToFloat(x)
|
f := constant.ToFloat(x)
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ type gen struct {
|
||||||
bytes.Buffer
|
bytes.Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *gen) p(format string, args ...interface{}) {
|
func (g *gen) p(format string, args ...any) {
|
||||||
fmt.Fprintf(&g.Buffer, format, args...)
|
fmt.Fprintf(&g.Buffer, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ func (u *unifier) unify(x, y Type, mode unifyMode) bool {
|
||||||
return u.nify(x, y, mode, nil)
|
return u.nify(x, y, mode, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *unifier) tracef(format string, args ...interface{}) {
|
func (u *unifier) tracef(format string, args ...any) {
|
||||||
fmt.Println(strings.Repeat(". ", u.depth) + sprintf(nil, nil, true, format, args...))
|
fmt.Println(strings.Repeat(". ", u.depth) + sprintf(nil, nil, true, format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func (check *Checker) allowVersion(want goVersion) bool {
|
||||||
|
|
||||||
// verifyVersionf is like allowVersion but also accepts a format string and arguments
|
// verifyVersionf is like allowVersion but also accepts a format string and arguments
|
||||||
// which are used to report a version error if allowVersion returns false.
|
// which are used to report a version error if allowVersion returns false.
|
||||||
func (check *Checker) verifyVersionf(at positioner, v goVersion, format string, args ...interface{}) bool {
|
func (check *Checker) verifyVersionf(at positioner, v goVersion, format string, args ...any) bool {
|
||||||
if !check.allowVersion(v) {
|
if !check.allowVersion(v) {
|
||||||
check.versionErrorf(at, v, format, args...)
|
check.versionErrorf(at, v, format, args...)
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ package abi
|
||||||
// compile-time error.
|
// compile-time error.
|
||||||
//
|
//
|
||||||
// Implemented as a compile intrinsic.
|
// Implemented as a compile intrinsic.
|
||||||
func FuncPCABI0(f interface{}) uintptr
|
func FuncPCABI0(f any) uintptr
|
||||||
|
|
||||||
// FuncPCABIInternal returns the entry PC of the function f. If f is a
|
// FuncPCABIInternal returns the entry PC of the function f. If f is a
|
||||||
// direct reference of a function, it must be defined as ABIInternal.
|
// direct reference of a function, it must be defined as ABIInternal.
|
||||||
|
|
@ -28,4 +28,4 @@ func FuncPCABI0(f interface{}) uintptr
|
||||||
// the behavior is undefined.
|
// the behavior is undefined.
|
||||||
//
|
//
|
||||||
// Implemented as a compile intrinsic.
|
// Implemented as a compile intrinsic.
|
||||||
func FuncPCABIInternal(f interface{}) uintptr
|
func FuncPCABIInternal(f any) uintptr
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ func collectPodsImpl(files []string, dirIndices []int, warn bool) []Pod {
|
||||||
return pods
|
return pods
|
||||||
}
|
}
|
||||||
|
|
||||||
func warning(s string, a ...interface{}) {
|
func warning(s string, a ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "warning: ")
|
fmt.Fprintf(os.Stderr, "warning: ")
|
||||||
fmt.Fprintf(os.Stderr, s, a...)
|
fmt.Fprintf(os.Stderr, s, a...)
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ func TestForgetUnshared(t *testing.T) {
|
||||||
key := "key"
|
key := "key"
|
||||||
firstCh := make(chan struct{})
|
firstCh := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
g.Do(key, func() (i interface{}, e error) {
|
g.Do(key, func() (i any, e error) {
|
||||||
firstStarted.Done()
|
firstStarted.Done()
|
||||||
<-firstCh
|
<-firstCh
|
||||||
return
|
return
|
||||||
|
|
@ -110,7 +110,7 @@ func TestForgetUnshared(t *testing.T) {
|
||||||
|
|
||||||
secondCh := make(chan struct{})
|
secondCh := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
g.Do(key, func() (i interface{}, e error) {
|
g.Do(key, func() (i any, e error) {
|
||||||
// Notify that we started
|
// Notify that we started
|
||||||
secondCh <- struct{}{}
|
secondCh <- struct{}{}
|
||||||
<-secondCh
|
<-secondCh
|
||||||
|
|
@ -120,7 +120,7 @@ func TestForgetUnshared(t *testing.T) {
|
||||||
|
|
||||||
<-secondCh
|
<-secondCh
|
||||||
|
|
||||||
resultCh := g.DoChan(key, func() (i interface{}, e error) {
|
resultCh := g.DoChan(key, func() (i any, e error) {
|
||||||
panic("third must not be started")
|
panic("third must not be started")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ func TestDoAndForgetUnsharedRace(t *testing.T) {
|
||||||
wg.Add(n)
|
wg.Add(n)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
g.Do(key, func() (interface{}, error) {
|
g.Do(key, func() (any, error) {
|
||||||
time.Sleep(d)
|
time.Sleep(d)
|
||||||
return calls.Add(1), nil
|
return calls.Add(1), nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ func checkAliasingTwoArgs(t *testing.T, f func(v, x, y *big.Int) *big.Int, v, x,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAliasing(t *testing.T) {
|
func TestAliasing(t *testing.T) {
|
||||||
for name, f := range map[string]interface{}{
|
for name, f := range map[string]any{
|
||||||
"Abs": func(v, x bigInt) bool {
|
"Abs": func(v, x bigInt) bool {
|
||||||
return checkAliasingOneArg(t, (*big.Int).Abs, v.Int, x.Int)
|
return checkAliasingOneArg(t, (*big.Int).Abs, v.Int, x.Int)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8096,11 +8096,11 @@ func TestValue_Len(t *testing.T) {
|
||||||
func TestValue_Comparable(t *testing.T) {
|
func TestValue_Comparable(t *testing.T) {
|
||||||
var a int
|
var a int
|
||||||
var s []int
|
var s []int
|
||||||
var i interface{} = a
|
var i any = a
|
||||||
var iNil interface{}
|
var iNil any
|
||||||
var iSlice interface{} = s
|
var iSlice any = s
|
||||||
var iArrayFalse interface{} = [2]interface{}{1, map[int]int{}}
|
var iArrayFalse any = [2]any{1, map[int]int{}}
|
||||||
var iArrayTrue interface{} = [2]interface{}{1, struct{ I interface{} }{1}}
|
var iArrayTrue any = [2]any{1, struct{ I any }{1}}
|
||||||
var testcases = []struct {
|
var testcases = []struct {
|
||||||
value Value
|
value Value
|
||||||
comparable bool
|
comparable bool
|
||||||
|
|
@ -8237,22 +8237,22 @@ func TestValue_Comparable(t *testing.T) {
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueOf([2]struct{ I interface{} }{{1}, {1}}),
|
ValueOf([2]struct{ I any }{{1}, {1}}),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueOf([2]struct{ I interface{} }{{[]int{}}, {1}}),
|
ValueOf([2]struct{ I any }{{[]int{}}, {1}}),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueOf([2]interface{}{1, struct{ I int }{1}}),
|
ValueOf([2]any{1, struct{ I int }{1}}),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueOf([2]interface{}{[1]interface{}{map[int]int{}}, struct{ I int }{1}}),
|
ValueOf([2]any{[1]any{map[int]int{}}, struct{ I int }{1}}),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
|
@ -8286,10 +8286,10 @@ type ValueEqualTest struct {
|
||||||
vDeref, uDeref bool
|
vDeref, uDeref bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var equalI interface{} = 1
|
var equalI any = 1
|
||||||
var equalSlice interface{} = []int{1}
|
var equalSlice any = []int{1}
|
||||||
var nilInterface interface{}
|
var nilInterface any
|
||||||
var mapInterface interface{} = map[int]int{}
|
var mapInterface any = map[int]int{}
|
||||||
|
|
||||||
var valueEqualTests = []ValueEqualTest{
|
var valueEqualTests = []ValueEqualTest{
|
||||||
{
|
{
|
||||||
|
|
@ -8468,8 +8468,8 @@ func TestValue_EqualNonComparable(t *testing.T) {
|
||||||
// Value of array is non-comparable because of non-comparable elements.
|
// Value of array is non-comparable because of non-comparable elements.
|
||||||
ValueOf([0]map[int]int{}),
|
ValueOf([0]map[int]int{}),
|
||||||
ValueOf([0]func(){}),
|
ValueOf([0]func(){}),
|
||||||
ValueOf(([1]struct{ I interface{} }{{[]int{}}})),
|
ValueOf(([1]struct{ I any }{{[]int{}}})),
|
||||||
ValueOf(([1]interface{}{[1]interface{}{map[int]int{}}})),
|
ValueOf(([1]any{[1]any{map[int]int{}}})),
|
||||||
}
|
}
|
||||||
for _, value := range values {
|
for _, value := range values {
|
||||||
// Panic when reflect.Value.Equal using two valid non-comparable values.
|
// Panic when reflect.Value.Equal using two valid non-comparable values.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
func TestTypeFor(t *testing.T) {
|
func TestTypeFor(t *testing.T) {
|
||||||
type (
|
type (
|
||||||
mystring string
|
mystring string
|
||||||
myiface interface{}
|
myiface any
|
||||||
)
|
)
|
||||||
|
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ func BenchmarkReadMetricsLatency(b *testing.B) {
|
||||||
b.ReportMetric(float64(latencies[len(latencies)*99/100]), "p99-ns")
|
b.ReportMetric(float64(latencies[len(latencies)*99/100]), "p99-ns")
|
||||||
}
|
}
|
||||||
|
|
||||||
var readMetricsSink [1024]interface{}
|
var readMetricsSink [1024]any
|
||||||
|
|
||||||
func TestReadMetricsCumulative(t *testing.T) {
|
func TestReadMetricsCumulative(t *testing.T) {
|
||||||
// Set up the set of metrics marked cumulative.
|
// Set up the set of metrics marked cumulative.
|
||||||
|
|
|
||||||
|
|
@ -1627,7 +1627,7 @@ func TestGoroutineProfileConcurrency(t *testing.T) {
|
||||||
obj := new(T)
|
obj := new(T)
|
||||||
ch1, ch2 := make(chan int), make(chan int)
|
ch1, ch2 := make(chan int), make(chan int)
|
||||||
defer close(ch2)
|
defer close(ch2)
|
||||||
runtime.SetFinalizer(obj, func(_ interface{}) {
|
runtime.SetFinalizer(obj, func(_ any) {
|
||||||
close(ch1)
|
close(ch1)
|
||||||
<-ch2
|
<-ch2
|
||||||
})
|
})
|
||||||
|
|
@ -1829,7 +1829,7 @@ func TestGoroutineProfileIssue74090(t *testing.T) {
|
||||||
var objs []*T
|
var objs []*T
|
||||||
for range 10000 {
|
for range 10000 {
|
||||||
obj := new(T)
|
obj := new(T)
|
||||||
runtime.SetFinalizer(obj, func(_ interface{}) {})
|
runtime.SetFinalizer(obj, func(_ any) {})
|
||||||
objs = append(objs, obj)
|
objs = append(objs, obj)
|
||||||
}
|
}
|
||||||
objs = nil
|
objs = nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue