Josh Bleecher Snyder | 17c513e | 2021-09-13 15:28:55 -0700 | [diff] [blame] | 1 | // errorcheckwithauto -0 -m -d=inlfuncswithclosures=1 |
| 2 | |
Josh Bleecher Snyder | 812a33d | 2021-10-06 13:42:17 -0700 | [diff] [blame] | 3 | //go:build (386 || amd64 || arm64 || ppc64le || s390x) && !gcflags_noopt |
Josh Bleecher Snyder | 17c513e | 2021-09-13 15:28:55 -0700 | [diff] [blame] | 4 | // +build 386 amd64 arm64 ppc64le s390x |
Josh Bleecher Snyder | 812a33d | 2021-10-06 13:42:17 -0700 | [diff] [blame] | 5 | // +build !gcflags_noopt |
Josh Bleecher Snyder | 17c513e | 2021-09-13 15:28:55 -0700 | [diff] [blame] | 6 | |
| 7 | // Copyright 2021 The Go Authors. All rights reserved. |
| 8 | // Use of this source code is governed by a BSD-style |
| 9 | // license that can be found in the LICENSE file. |
| 10 | |
| 11 | // Similar to inline.go, but only for architectures that can merge loads. |
| 12 | |
| 13 | package foo |
| 14 | |
| 15 | import ( |
| 16 | "encoding/binary" |
| 17 | ) |
| 18 | |
| 19 | // Ensure that simple encoding/binary functions are cheap enough |
| 20 | // that functions using them can also be inlined (issue 42958). |
| 21 | func endian(b []byte) uint64 { // ERROR "can inline endian" "b does not escape" |
| 22 | return binary.LittleEndian.Uint64(b) + binary.BigEndian.Uint64(b) // ERROR "inlining call to binary.littleEndian.Uint64" "inlining call to binary.bigEndian.Uint64" |
| 23 | } |