Permalink
Browse files

cmd/vet: fix go vet on parentheses of assembly function flag

Current implementation doesn't recognize parentheses that may appear in flags
of assembly function as shown below:

	TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$24

It results in vet reporting false positives and a lot of whitelists are added
for suppressing the false alarms.

This CL fixes the issue and eliminates the redundant whitelists.

Change-Id: Idbc1b42965b31cea8ee7c23d1a6f62feb68e844c
Reviewed-on: https://go-review.googlesource.com/62850
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
  • Loading branch information...
Wei Xiao authored and robpike committed Sep 11, 2017
1 parent 9f1a719 commit 701d49245fcbe9cf095be2afadab0a68986acb72
@@ -3,8 +3,6 @@
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: Compare is in package bytes
// reflect trampolines intentionally omit arg size. Same for morestack.
reflect/asm_386.s: [386] makeFuncStub: use of 4(SP) points beyond argument frame
reflect/asm_386.s: [386] methodValueCall: use of 4(SP) points beyond argument frame
runtime/asm_386.s: [386] morestack: use of 4(SP) points beyond argument frame
runtime/asm_386.s: [386] morestack: use of 8(SP) points beyond argument frame
runtime/asm_386.s: [386] morestack: use of 4(SP) points beyond argument frame
@@ -5,8 +5,6 @@
// reflect trampolines intentionally omit arg size. Same for morestack.
reflect/asm_amd64.s: [amd64] makeFuncStub: use of 8(SP) points beyond argument frame
reflect/asm_amd64.s: [amd64] methodValueCall: use of 8(SP) points beyond argument frame
runtime/asm_amd64.s: [amd64] morestack: use of 8(SP) points beyond argument frame
runtime/asm_amd64.s: [amd64] morestack: use of 16(SP) points beyond argument frame
runtime/asm_amd64.s: [amd64] morestack: use of 8(SP) points beyond argument frame
@@ -3,8 +3,6 @@
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: Compare is in package bytes
// reflect trampolines intentionally omit arg size. Same for morestack.
reflect/asm_arm.s: [arm] makeFuncStub: use of 8(R13) points beyond argument frame
reflect/asm_arm.s: [arm] methodValueCall: use of 8(R13) points beyond argument frame
runtime/asm_arm.s: [arm] morestack: use of 4(R13) points beyond argument frame
// Intentionally missing declarations.
@@ -2,12 +2,6 @@
runtime/asm_ARCHSUFF.s: [GOARCH] cannot check cross-package assembly function: Compare is in package bytes
// False positives.
// reflect trampolines intentionally omit arg size. Same for morestack.
reflect/asm_arm64.s: [arm64] makeFuncStub: use of 16(RSP) points beyond argument frame
reflect/asm_arm64.s: [arm64] methodValueCall: use of 16(RSP) points beyond argument frame
// Intentionally missing declarations.
runtime/asm_arm64.s: [arm64] abort: function abort missing Go declaration
runtime/asm_arm64.s: [arm64] addmoduledata: function addmoduledata missing Go declaration
@@ -1,7 +1,5 @@
// mips64-specific vet whitelist. See readme.txt for details.
reflect/asm_mips64x.s: [GOARCH] makeFuncStub: use of 16(R29) points beyond argument frame
reflect/asm_mips64x.s: [GOARCH] methodValueCall: use of 16(R29) points beyond argument frame
runtime/asm_mips64x.s: [GOARCH] abort: function abort missing Go declaration
runtime/duff_mips64x.s: [GOARCH] duffzero: function duffzero missing Go declaration
runtime/tls_mips64x.s: [GOARCH] save_g: function save_g missing Go declaration
@@ -1,7 +1,5 @@
// mips64-specific vet whitelist. See readme.txt for details.
reflect/asm_mipsx.s: [GOARCH] makeFuncStub: use of 8(R29) points beyond argument frame
reflect/asm_mipsx.s: [GOARCH] methodValueCall: use of 8(R29) points beyond argument frame
runtime/asm_mipsx.s: [GOARCH] abort: function abort missing Go declaration
runtime/tls_mipsx.s: [GOARCH] save_g: function save_g missing Go declaration
runtime/tls_mipsx.s: [GOARCH] load_g: function load_g missing Go declaration
@@ -1,8 +1,6 @@
// nacl/amd64p32-specific vet whitelist. See readme.txt for details.
// reflect trampolines intentionally omit arg size. Same for morestack.
reflect/asm_amd64p32.s: [amd64p32] makeFuncStub: use of 4(SP) points beyond argument frame
reflect/asm_amd64p32.s: [amd64p32] methodValueCall: use of 4(SP) points beyond argument frame
runtime/asm_amd64p32.s: [amd64p32] morestack: use of 8(SP) points beyond argument frame
runtime/asm_amd64p32.s: [amd64p32] morestack: use of 16(SP) points beyond argument frame
runtime/asm_amd64p32.s: [amd64p32] morestack: use of 8(SP) points beyond argument frame
@@ -1,5 +1,3 @@
reflect/asm_s390x.s: [s390x] makeFuncStub: use of 16(R15) points beyond argument frame
reflect/asm_s390x.s: [s390x] methodValueCall: use of 16(R15) points beyond argument frame
runtime/asm_s390x.s: [s390x] abort: function abort missing Go declaration
runtime/asm_s390x.s: [s390x] memeqbody: function memeqbody missing Go declaration
runtime/asm_s390x.s: [s390x] memeqbodyclc: function memeqbodyclc missing Go declaration
View
@@ -109,7 +109,7 @@ func init() {
var (
re = regexp.MustCompile
asmPlusBuild = re(`//\s+\+build\s+([^\n]+)`)
asmTEXT = re(`\bTEXT\b(.*)·([^\(]+)\(SB\)(?:\s*,\s*([0-9A-Z|+]+))?(?:\s*,\s*\$(-?[0-9]+)(?:-([0-9]+))?)?`)
asmTEXT = re(`\bTEXT\b(.*)·([^\(]+)\(SB\)(?:\s*,\s*([0-9A-Z|+()]+))?(?:\s*,\s*\$(-?[0-9]+)(?:-([0-9]+))?)?`)
asmDATA = re(`\b(DATA|GLOBL)\b`)
asmNamedFP = re(`([a-zA-Z0-9_\xFF-\x{10FFFF}]+)(?:\+([0-9]+))\(FP\)`)
asmUnnamedFP = re(`[^+\-0-9](([0-9]+)\(FP\))`)

0 comments on commit 701d492

Please sign in to comment.