Skip to content

Commit

Permalink
chore: add //go:nocheckptr
Browse files Browse the repository at this point in the history
Change-Id: I11cb0fe5e5d8d78efea25f0f52b8f2ae26dd26a2
  • Loading branch information
andeya committed Dec 2, 2020
1 parent ae193d1 commit 12f24da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestBuiltInFunc(t *testing.T) {
}{
{expr: "len('abc')", val: 3.0},
{expr: "len('abc')+2*2/len('cd')", val: 5.0},
{expr: "len(0)", val: nil},
{expr: "len(0)", val: 0},

{expr: "regexp('a\\d','a0')", val: true},
{expr: "regexp('^a\\d$','a0')", val: true},
Expand Down
3 changes: 3 additions & 0 deletions tagexpr.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var unsupportNil = errors.New("unsupport data: nil")
// NOTE:
// If the structure type has not been warmed up,
// it will be slower when it is first called.
// Disable new -d=checkptr behaviour for Go 1.14
//go:nocheckptr
func (vm *VM) Run(structOrStructPtrOrReflectValue interface{}) (*TagExpr, error) {
var u tpack.U
v, isReflectValue := structOrStructPtrOrReflectValue.(reflect.Value)
Expand Down Expand Up @@ -1066,6 +1068,7 @@ func safeIsNil(v reflect.Value) bool {
return false
}

//go:nocheckptr
func ptrElem(ptr unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer(*(*uintptr)(ptr))
}
Expand Down

0 comments on commit 12f24da

Please sign in to comment.