go.tools/cmd/vet: don't panic on commented-out asm
Really two fixes: Don't panic on bad instructions and don't complain about commented out instructions. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/110070044
This commit is contained in:
parent
9d6cc5fd08
commit
95a7aeb192
|
|
@ -423,7 +423,10 @@ func (f *File) asmParseDecl(decl *ast.FuncDecl) map[string]*asmFunc {
|
|||
func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr string, off int, v *asmVar) {
|
||||
m := asmOpcode.FindStringSubmatch(line)
|
||||
if m == nil {
|
||||
badf("cannot find assembly opcode")
|
||||
if !strings.HasPrefix(strings.TrimSpace(line), "//") {
|
||||
badf("cannot find assembly opcode")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Determine operand sizes from instruction.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
TEXT ·arg1(SB),0,$0-2
|
||||
MOVB x+0(FP), AX
|
||||
// MOVB x+0(FP), AX // commented out instructions used to panic
|
||||
MOVB y+1(FP), BX
|
||||
MOVW x+0(FP), AX // ERROR "\[amd64\] invalid MOVW of x\+0\(FP\); int8 is 1-byte value"
|
||||
MOVW y+1(FP), AX // ERROR "invalid MOVW of y\+1\(FP\); uint8 is 1-byte value"
|
||||
|
|
|
|||
Loading…
Reference in New Issue