2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00

build: omit checkptr detects on unsafe functions (#372)

* build: omit `checkptr` detect on unsafe functions

* update CI
This commit is contained in:
Yi Duan 2023-02-28 19:13:19 +08:00 committed by GitHub
parent 3696f9175b
commit 6d60889e3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 11 deletions

View file

@ -12,6 +12,6 @@ jobs:
- uses: actions/checkout@v2
- name: Check License Header
uses: apache/skywalking-eyes/header@main
uses: apache/skywalking-eyes/header@v0.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -25,8 +25,8 @@ jobs:
- name: Unit Test
run: |
GOMAXPROCS=4 go test -v -race -gcflags=-d=checkptr=0 ./...
GOMAXPROCS=4 go test -v -race -gcflags=-d=checkptr=0 ./external_jsonlib_test/...
GOMAXPROCS=4 go test -v -race ./...
GOMAXPROCS=4 go test -v -race ./external_jsonlib_test/...
- name: Generic Test
run: GOMAXPROCS=4 go test -v -race -gcflags=-d=checkptr=0 ./generic_test
run: GOMAXPROCS=4 go test -v -race ./generic_test

View file

@ -28,7 +28,7 @@ jobs:
${{ runner.os }}-go-
- name: Compatibility Test - main
run: GOMAXPROCS=4 go test -v -gcflags=-d=checkptr=0 -race github.com/bytedance/sonic
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic
- name: Compatibility Test - ast
run: GOMAXPROCS=4 go test -v -gcflags=-d=checkptr=0 -race github.com/bytedance/sonic/ast
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast

View file

@ -28,6 +28,6 @@ jobs:
- name: Unit Test
run: |
go test -v -gcflags=-d=checkptr=0 ./...
go test -v ./...
cd ./external_jsonlib_test
go test -v -gcflags=-d=checkptr=0 ./...
go test -v ./...

View file

@ -32,5 +32,5 @@ jobs:
printf ' #!/bin/bash\n if [ ! -x "/usr/bin/qemu-x86_64" ];then\n sudo apt-get update\n sudo apt-get -y install make gcc g++ libglib2.0-dev libpixman-1-dev libfdt-dev python3-pip ninja-build\n sudo pip3 install meson\n wget https://download.qemu.org/qemu-6.2.0.tar.xz\n tar -xvf qemu-6.2.0.tar.xz\n cd qemu-6.2.0\n sudo ./configure\n sudo make -j 4\n sudo make install\n cd ..\n cp /usr/local/bin/qemu-x86_64 /usr/bin/qemu-x86_64\n fi\n' > qemu_install.sh
chmod +x qemu_install.sh
./qemu_install.sh
GOARCH=amd64 go test -gcflags=-d=checkptr=0 -c .
GOARCH=amd64 go test -c .
qemu-x86_64 -cpu max ./sonic.test -test.v

View file

@ -24,4 +24,4 @@ jobs:
${{ runner.os }}-go-
- name: Compatibility Test
run: go test -v -gcflags=-d=checkptr=0 .
run: go test -v .

View file

@ -17,6 +17,7 @@ import (
var typeByte = rt.UnpackEface(byte(0)).Type
//go:nocheckptr
func quote(buf *[]byte, val string) {
*buf = append(*buf, '"')
if len(val) == 0 {

View file

@ -24,6 +24,7 @@ func isSpace(c byte) bool {
return (int(1<<c) & _blankCharsMask) != 0
}
//go:nocheckptr
func skipBlank(src string, pos int) int {
se := uintptr(rt.IndexChar(src, len(src)))
sp := uintptr(rt.IndexChar(src, pos))
@ -77,6 +78,7 @@ func decodeFalse(src string, pos int) (ret int) {
return -int(types.ERR_INVALID_CHAR)
}
//go:nocheckptr
func decodeString(src string, pos int) (ret int, v string) {
ret, ep := skipString(src, pos)
if ep == -1 {
@ -112,6 +114,7 @@ func isDigit(c byte) bool {
return c >= '0' && c <= '9'
}
//go:nocheckptr
func decodeInt64(src string, pos int) (ret int, v int64, err error) {
sp := uintptr(rt.IndexChar(src, pos))
ss := uintptr(sp)
@ -161,6 +164,7 @@ func isNumberChars(c byte) bool {
return (c >= '0' && c <= '9') || c == '+' || c == '-' || c == 'e' || c == 'E' || c == '.'
}
//go:nocheckptr
func decodeFloat64(src string, pos int) (ret int, v float64, err error) {
sp := uintptr(rt.IndexChar(src, pos))
ss := uintptr(sp)
@ -255,6 +259,7 @@ func decodeValue(src string, pos int) (ret int, v types.JsonState) {
}
}
//go:nocheckptr
func skipNumber(src string, pos int) (ret int) {
sp := uintptr(rt.IndexChar(src, pos))
se := uintptr(rt.IndexChar(src, len(src)))
@ -319,6 +324,7 @@ func skipNumber(src string, pos int) (ret int) {
return int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr))
}
//go:nocheckptr
func skipString(src string, pos int) (ret int, ep int) {
if pos+1 >= len(src) {
return -int(types.ERR_EOF), -1
@ -356,6 +362,7 @@ func skipString(src string, pos int) (ret int, ep int) {
return int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr)), ep
}
//go:nocheckptr
func skipPair(src string, pos int, lchar byte, rchar byte) (ret int) {
if pos+1 >= len(src) {
return -int(types.ERR_EOF)

View file

@ -87,7 +87,6 @@ func GuardSlice(buf *[]byte, n int) {
copy(tmp, *buf)
*buf = tmp
}
return
}
//go:nosplit