chore(deps): Update sqlite dependencies
This commit is contained in:
go.modgo.summodules.txt
vendor
golang.org
x
sys
AUTHORSCONTRIBUTORS
unix
asm_linux_loong64.serrors_freebsd_386.goerrors_freebsd_amd64.goerrors_freebsd_arm.goerrors_freebsd_arm64.gomkall.shmkerrors.shsyscall_aix.gosyscall_bsd.gosyscall_darwin.gosyscall_freebsd.gosyscall_freebsd_386.gosyscall_freebsd_amd64.gosyscall_freebsd_arm.gosyscall_freebsd_arm64.gosyscall_illumos.gosyscall_linux.gosyscall_linux_loong64.gosyscall_linux_riscv64.gosyscall_openbsd_mips64.gosyscall_solaris.gosyscall_unix.gozerrors_freebsd_386.gozerrors_freebsd_amd64.gozerrors_freebsd_arm.gozerrors_freebsd_arm64.gozerrors_linux.gozerrors_linux_386.gozerrors_linux_amd64.gozerrors_linux_arm.gozerrors_linux_arm64.gozerrors_linux_loong64.gozerrors_linux_mips.gozerrors_linux_mips64.gozerrors_linux_mips64le.gozerrors_linux_mipsle.gozerrors_linux_ppc.gozerrors_linux_ppc64.gozerrors_linux_ppc64le.gozerrors_linux_riscv64.gozerrors_linux_s390x.gozerrors_linux_sparc64.gozsyscall_darwin_amd64.1_13.szsyscall_darwin_amd64.szsyscall_darwin_arm64.1_13.szsyscall_darwin_arm64.szsyscall_freebsd_386.gozsyscall_freebsd_amd64.gozsyscall_freebsd_arm.gozsyscall_freebsd_arm64.gozsyscall_linux_loong64.gozsyscall_linux_riscv64.gozsyscall_openbsd_386.gozsyscall_openbsd_amd64.gozsyscall_openbsd_arm64.gozsyscall_solaris_amd64.gozsysnum_freebsd_386.gozsysnum_freebsd_amd64.gozsysnum_freebsd_arm.gozsysnum_freebsd_arm64.gozsysnum_linux_386.gozsysnum_linux_amd64.gozsysnum_linux_arm.gozsysnum_linux_arm64.gozsysnum_linux_loong64.gozsysnum_linux_mips.gozsysnum_linux_mips64.gozsysnum_linux_mips64le.gozsysnum_linux_mipsle.gozsysnum_linux_ppc.gozsysnum_linux_ppc64.gozsysnum_linux_ppc64le.gozsysnum_linux_riscv64.gozsysnum_linux_s390x.gozsysnum_linux_sparc64.gozsysnum_openbsd_386.gozsysnum_openbsd_amd64.gozsysnum_openbsd_arm64.goztypes_darwin_amd64.goztypes_darwin_arm64.goztypes_freebsd_386.goztypes_freebsd_amd64.goztypes_freebsd_arm.goztypes_freebsd_arm64.goztypes_linux.goztypes_linux_386.goztypes_linux_amd64.goztypes_linux_arm.goztypes_linux_arm64.goztypes_linux_loong64.goztypes_linux_mips.goztypes_linux_mips64.goztypes_linux_mips64le.goztypes_linux_mipsle.goztypes_linux_ppc.goztypes_linux_ppc64.goztypes_linux_ppc64le.goztypes_linux_riscv64.goztypes_linux_s390x.goztypes_linux_sparc64.goztypes_solaris_amd64.go
windows
lukechampine.com
uint128
modernc.org
cc
v3
ccgo
libc
AUTHORSCONTRIBUTORSMakefilecapi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_386.gocapi_linux_amd64.gocapi_linux_arm.gocapi_linux_arm64.gocapi_linux_s390x.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.goccgo.goioutil_darwin.goioutil_freebsd.goioutil_linux.goioutil_netbsd.gonopthreads.go
errno
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.goerrno_darwin_amd64.goerrno_darwin_arm64.goerrno_freebsd_amd64.goerrno_linux_386.goerrno_linux_amd64.goerrno_linux_arm.goerrno_linux_arm64.goerrno_netbsd_amd64.goerrno_windows_386.goerrno_windows_amd64.go
etc.gofcntl
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gofcntl_darwin_amd64.gofcntl_darwin_arm64.gofcntl_freebsd_amd64.gofcntl_linux_386.gofcntl_linux_amd64.gofcntl_linux_arm.gofcntl_linux_arm64.gofcntl_linux_s390x.gofcntl_netbsd_amd64.gofcntl_windows_386.gofcntl_windows_amd64.go
fts
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gofts_darwin_amd64.gofts_darwin_arm64.gofts_freebsd_amd64.gofts_linux_386.gofts_linux_amd64.gofts_linux_arm.gofts_linux_arm64.gofts_linux_s390x.gofts_netbsd_amd64.go
grp
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gogrp_darwin_amd64.gogrp_darwin_arm64.gogrp_freebsd_amd64.gogrp_linux_386.gogrp_linux_amd64.gogrp_linux_arm.gogrp_linux_arm64.gogrp_linux_s390x.gogrp_netbsd_amd64.go
honnef.co
go
netdb
langinfo
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.golanginfo_darwin_amd64.golanginfo_darwin_arm64.golanginfo_freebsd_amd64.golanginfo_linux_386.golanginfo_linux_amd64.golanginfo_linux_arm.golanginfo_linux_arm64.golanginfo_linux_s390x.golanginfo_netbsd_amd64.go
libc.golibc32.golibc64.golibc_darwin.golibc_darwin_amd64.golibc_darwin_arm64.golibc_freebsd.golibc_freebsd_amd64.golibc_linux.golibc_linux_amd64.golibc_linux_s390x.golibc_netbsd.golibc_netbsd_amd64.golibc_unix.golibc_windows.golibc_windows_386.golibc_windows_amd64.golimits
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.golimits_darwin_amd64.golimits_darwin_arm64.golimits_freebsd_amd64.golimits_linux_386.golimits_linux_amd64.golimits_linux_arm.golimits_linux_arm64.golimits_linux_s390x.golimits_netbsd_amd64.golimits_windows_386.golimits_windows_amd64.go
log-generatemem_brk.gomusl_darwin_amd64.gomusl_darwin_arm64.gomusl_freebsd_amd64.gomusl_linux_386.gomusl_linux_amd64.gomusl_linux_arm.gomusl_linux_arm64.gomusl_linux_s390x.gomusl_netbsd_amd64.gomusl_windows_386.gomusl_windows_amd64.gonetdb
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gonetdb_darwin_amd64.gonetdb_darwin_arm64.gonetdb_freebsd_amd64.gonetdb_linux_386.gonetdb_linux_amd64.gonetdb_linux_arm.gonetdb_linux_arm64.gonetdb_linux_s390x.gonetdb_netbsd_amd64.go
netinet
in
poll
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gopoll_darwin_amd64.gopoll_darwin_arm64.gopoll_freebsd_amd64.gopoll_linux_386.gopoll_linux_amd64.gopoll_linux_arm.gopoll_linux_arm64.gopoll_linux_s390x.gopoll_netbsd_amd64.go
printf.gopthread
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gopthread_darwin_amd64.gopthread_darwin_arm64.gopthread_freebsd_amd64.gopthread_linux_386.gopthread_linux_amd64.gopthread_linux_arm.gopthread_linux_arm64.gopthread_linux_s390x.gopthread_netbsd_amd64.gopthread_windows_386.gopthread_windows_amd64.go
pthreads.gopwd
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gopwd_darwin_amd64.gopwd_darwin_arm64.gopwd_freebsd_amd64.gopwd_linux_386.gopwd_linux_amd64.gopwd_linux_arm.gopwd_linux_arm64.gopwd_linux_s390x.gopwd_netbsd_amd64.go
scanf.gosignal
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gosignal_darwin_amd64.gosignal_darwin_arm64.gosignal_freebsd_amd64.gosignal_linux_386.gosignal_linux_amd64.gosignal_linux_arm.gosignal_linux_arm64.gosignal_linux_s390x.gosignal_netbsd_amd64.gosignal_windows_386.gosignal_windows_amd64.go
stdio
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gostdio_darwin_amd64.gostdio_darwin_arm64.gostdio_freebsd_amd64.gostdio_linux_386.gostdio_linux_amd64.gostdio_linux_arm.gostdio_linux_arm64.gostdio_linux_s390x.gostdio_netbsd_amd64.gostdio_windows_386.gostdio_windows_amd64.go
sync_linux_amd64.gosync_linux_amd64.ssys
socket
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gosocket_darwin_amd64.gosocket_darwin_arm64.gosocket_freebsd_amd64.gosocket_linux_386.gosocket_linux_amd64.gosocket_linux_arm.gosocket_linux_arm64.gosocket_linux_s390x.gosocket_netbsd_amd64.go
stat
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gostat_darwin_amd64.gostat_darwin_arm64.gostat_freebsd_amd64.gostat_linux_386.gostat_linux_amd64.gostat_linux_arm.gostat_linux_arm64.gostat_linux_s390x.gostat_netbsd_amd64.gostat_windows_386.gostat_windows_amd64.go
types
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gotypes_darwin_amd64.gotypes_darwin_arm64.gotypes_freebsd_amd64.gotypes_linux_386.gotypes_linux_amd64.gotypes_linux_arm.gotypes_linux_arm64.gotypes_linux_s390x.gotypes_netbsd_amd64.gotypes_windows_386.gotypes_windows_amd64.go
termios
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gotermios_darwin_amd64.gotermios_darwin_arm64.gotermios_freebsd_amd64.gotermios_linux_386.gotermios_linux_amd64.gotermios_linux_arm.gotermios_linux_arm64.gotermios_linux_s390x.gotermios_netbsd_amd64.go
time
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gotime_darwin_amd64.gotime_darwin_arm64.gotime_freebsd_amd64.gotime_linux_386.gotime_linux_amd64.gotime_linux_arm.gotime_linux_arm64.gotime_linux_s390x.gotime_netbsd_amd64.gotime_windows_386.gotime_windows_amd64.go
unistd
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.gounistd_darwin_amd64.gounistd_darwin_arm64.gounistd_freebsd_amd64.gounistd_linux_386.gounistd_linux_amd64.gounistd_linux_arm.gounistd_linux_arm64.gounistd_linux_s390x.gounistd_netbsd_amd64.gounistd_windows_386.gounistd_windows_amd64.go
utime
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_amd64.gocapi_netbsd_amd64.gocapi_windows_386.gocapi_windows_amd64.goutime_darwin_amd64.goutime_darwin_arm64.goutime_freebsd_amd64.goutime_linux_386.goutime_linux_amd64.goutime_linux_arm.goutime_linux_arm64.goutime_linux_s390x.goutime_netbsd_amd64.goutime_windows_386.goutime_windows_amd64.go
uuid
mathutil
memory
AUTHORSCONTRIBUTORSMakefilecounters.gomemory32.gomemory64.gommap_unix.gonocounters.gotrace_disabled.gotrace_enabled.go
opt
sqlite
AUTHORSCONTRIBUTORSMakefileREADME.mddoc.gogenerator.go
lib
capi_darwin_amd64.gocapi_darwin_arm64.gocapi_freebsd_amd64.gocapi_linux_386.gocapi_linux_amd64.gocapi_linux_arm.gocapi_linux_arm64.gocapi_linux_s390x.gocapi_windows_386.gocapi_windows_amd64.gomutex.gosqlite_darwin_amd64.gosqlite_darwin_arm64.gosqlite_freebsd_amd64.gosqlite_linux_386.gosqlite_linux_amd64.gosqlite_linux_arm.gosqlite_linux_arm64.gosqlite_linux_s390x.gosqlite_windows_386.gosqlite_windows_amd64.go
rlimit.gorlimit_freebsd.gosqlite.gounconvert.sh
223
vendor/modernc.org/ccgo/v3/lib/init.go
generated
vendored
223
vendor/modernc.org/ccgo/v3/lib/init.go
generated
vendored
@ -59,7 +59,7 @@ func (p *project) initializerInner(tag string, off uintptr, f *function, s []*cc
|
||||
tld.patches = append(tld.patches, initPatch{t, s[0], patchField})
|
||||
p.w(" 0 ")
|
||||
default:
|
||||
p.assignmentExpression(f, s[0].AssignmentExpression, t, exprValue, fOutermost)
|
||||
p.assignmentExpression(f, s[0].AssignmentExpression, t, exprValue, 0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -79,7 +79,7 @@ func (p *project) initializerInner(tag string, off uintptr, f *function, s []*cc
|
||||
case cc.Struct, cc.Union:
|
||||
if compatibleStructOrUnion(t, s[0].AssignmentExpression.Operand.Type()) {
|
||||
p.w("%s%s", tidyComment("", s[0]), tag)
|
||||
p.assignmentExpression(f, s[0].AssignmentExpression, t, exprValue, fOutermost)
|
||||
p.assignmentExpression(f, s[0].AssignmentExpression, t, exprValue, 0)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -87,9 +87,6 @@ func (p *project) initializerInner(tag string, off uintptr, f *function, s []*cc
|
||||
|
||||
if k == cc.Array && len(s) == 1 {
|
||||
et := t.Elem()
|
||||
if dmesgs { //TODO-
|
||||
dmesg("%v: %v", s[0].Position(), et)
|
||||
}
|
||||
switch {
|
||||
case isCharType(et):
|
||||
// 14: An array of character type may be initialized by a character string
|
||||
@ -147,13 +144,13 @@ func (p *project) initializerInner(tag string, off uintptr, f *function, s []*cc
|
||||
case cc.Union:
|
||||
p.initializerUnion(tag, off, f, s, t, sc, tld, lm, tm)
|
||||
default:
|
||||
panic(todo("%v: internal error: %v %v", s[0].Position(), t, len(s)))
|
||||
panic(todo("%v: internal error: %v alias %v %v", s[0].Position(), t, t.Alias(), len(s)))
|
||||
}
|
||||
}
|
||||
|
||||
func (p *project) initializerArray(tag string, off uintptr, f *function, s []*cc.Initializer, t cc.Type, sc cc.StorageClass, tld *tld, lm, tm map[*cc.Initializer][]cc.StringID) {
|
||||
if len(s) == 0 {
|
||||
p.w("%s{}", p.typ(nil, t))
|
||||
p.w("%s%s{}", tag, p.typ(nil, t))
|
||||
return
|
||||
}
|
||||
|
||||
@ -172,7 +169,7 @@ func (p *project) initializerArray(tag string, off uintptr, f *function, s []*cc
|
||||
for _, parts = range a {
|
||||
var comma *cc.Token
|
||||
comma = parts[len(parts)-1].TrailingComma()
|
||||
elemOff := parts[0].Offset - off
|
||||
elemOff := (parts[0].Offset - off) / esz * esz
|
||||
tag = ""
|
||||
if mustIndex {
|
||||
tag = fmt.Sprintf("%d:", elemOff/esz)
|
||||
@ -217,7 +214,7 @@ func (p *project) initializerArrayElement(off uintptr, s []*cc.Initializer, elem
|
||||
|
||||
func (p *project) initializerStruct(tag string, off uintptr, f *function, s []*cc.Initializer, t cc.Type, sc cc.StorageClass, tld *tld, lm, tm map[*cc.Initializer][]cc.StringID) {
|
||||
if len(s) == 0 {
|
||||
p.w("%s{}", p.typ(nil, t))
|
||||
p.w("%s%s{}", tag, p.typ(nil, t))
|
||||
return
|
||||
}
|
||||
|
||||
@ -232,7 +229,7 @@ func (p *project) initializerStruct(tag string, off uintptr, f *function, s []*c
|
||||
var fld cc.Field
|
||||
for len(s) != 0 {
|
||||
var comma *cc.Token
|
||||
s, fld, parts, isZero = p.initializerStructField(off, s, t)
|
||||
s, fld, parts, isZero = p.structInitializerParts(off, s, t)
|
||||
if isZero {
|
||||
continue
|
||||
}
|
||||
@ -246,6 +243,8 @@ func (p *project) initializerStruct(tag string, off uintptr, f *function, s []*c
|
||||
ft := fld.Type()
|
||||
switch {
|
||||
case fld.IsBitField():
|
||||
bft := p.bitFileType(parts[0], fld.BitFieldBlockWidth())
|
||||
off0 := fld.Offset()
|
||||
first := true
|
||||
for _, v := range parts {
|
||||
if v.AssignmentExpression.Operand.IsZero() {
|
||||
@ -257,12 +256,11 @@ func (p *project) initializerStruct(tag string, off uintptr, f *function, s []*c
|
||||
}
|
||||
first = false
|
||||
bitFld := v.Field
|
||||
bft := p.bitFileType(bitFld.BitFieldBlockWidth())
|
||||
p.w("%s%s", tidyComment("", v.AssignmentExpression), tag)
|
||||
tag = ""
|
||||
p.assignmentExpression(f, v.AssignmentExpression, bft, exprValue, fOutermost)
|
||||
p.assignmentExpression(f, v.AssignmentExpression, bft, exprValue, 0)
|
||||
p.w("&%#x", uint64(1)<<uint64(bitFld.BitFieldWidth())-1)
|
||||
if o := bitFld.BitFieldOffset(); o != 0 {
|
||||
if o := bitFld.BitFieldOffset() + 8*int((bitFld.Offset()-off0)); o != 0 {
|
||||
p.w("<<%d", o)
|
||||
}
|
||||
}
|
||||
@ -283,150 +281,141 @@ func (p *project) preCommaSep(comma *cc.Token) {
|
||||
p.w("%s", strings.TrimSpace(comma.Sep.String()))
|
||||
}
|
||||
|
||||
func (p *project) initializerStructField(off uintptr, s []*cc.Initializer, t cc.Type) (r []*cc.Initializer, fld cc.Field, parts []*cc.Initializer, isZero bool) {
|
||||
r = s
|
||||
isZero = true
|
||||
valueOff := s[0].Offset
|
||||
nf := t.NumField()
|
||||
nextOff := off + t.Size()
|
||||
bits := false
|
||||
for i := []int{0}; i[0] < nf; i[0]++ {
|
||||
fld2 := t.FieldByIndex(i)
|
||||
if fld == nil {
|
||||
fld = fld2
|
||||
}
|
||||
if fld2.Offset()+off > valueOff {
|
||||
nextOff = off + fld2.Offset()
|
||||
func (p *project) structInitializerParts(off uintptr, s []*cc.Initializer, t cc.Type) (r []*cc.Initializer, fld cc.Field, parts []*cc.Initializer, isZero bool) {
|
||||
if len(s) == 0 {
|
||||
return nil, nil, nil, true
|
||||
}
|
||||
|
||||
part := s[0]
|
||||
isZero = part.AssignmentExpression.Operand.IsZero()
|
||||
parts = append(parts, part)
|
||||
s = s[1:]
|
||||
fld, _, fNext := p.containingStructField(part, off, t)
|
||||
for len(s) != 0 {
|
||||
part = s[0]
|
||||
vOff := part.Offset
|
||||
if vOff >= fNext {
|
||||
break
|
||||
}
|
||||
|
||||
if !fld2.IsBitField() {
|
||||
fld = fld2
|
||||
isZero = isZero && part.AssignmentExpression.Operand.IsZero()
|
||||
parts = append(parts, part)
|
||||
s = s[1:]
|
||||
}
|
||||
return s, fld, parts, isZero
|
||||
}
|
||||
|
||||
func (p *project) containingStructField(part *cc.Initializer, off uintptr, t cc.Type) (f cc.Field, fOff, fNext uintptr) {
|
||||
nf := t.NumField()
|
||||
vOff := part.Offset
|
||||
for i := []int{0}; i[0] < nf; i[0]++ {
|
||||
f = t.FieldByIndex(i)
|
||||
if f.IsBitField() && f.Name() == 0 { // Anonymous bit fields cannot be initialized.
|
||||
continue
|
||||
}
|
||||
|
||||
fld = fld2.BitFieldBlockFirst()
|
||||
}
|
||||
for len(s) != 0 {
|
||||
if v := s[0]; v.Offset < nextOff || v.Type().Size() == 0 {
|
||||
if v.Field != nil && v.Field.IsBitField() {
|
||||
bits = true
|
||||
}
|
||||
s = s[1:]
|
||||
parts = append(parts, v)
|
||||
if !v.AssignmentExpression.Operand.IsZero() {
|
||||
isZero = false
|
||||
}
|
||||
continue
|
||||
fOff = off + f.Offset()
|
||||
switch {
|
||||
case f.IsBitField():
|
||||
fNext = fOff + uintptr(f.BitFieldBlockWidth())>>3
|
||||
default:
|
||||
fNext = fOff + f.Type().Size()
|
||||
}
|
||||
if vOff >= fOff && vOff < fNext {
|
||||
return f, fOff, fNext
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
if bits && fld.Name() == 0 {
|
||||
for _, v := range parts {
|
||||
if v.Field != nil && v.Field.Name() != 0 {
|
||||
fld = v.Field
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return r[len(parts):], fld, parts, isZero
|
||||
panic(todo("%v: internal error", p.pos(part)))
|
||||
}
|
||||
|
||||
func (p *project) initializerUnion(tag string, off uintptr, f *function, s []*cc.Initializer, t cc.Type, sc cc.StorageClass, tld *tld, lm, tm map[*cc.Initializer][]cc.StringID) {
|
||||
if len(s) == 0 {
|
||||
p.w("%s{}", p.typ(nil, t))
|
||||
p.w("%s%s{}", tag, p.typ(nil, t))
|
||||
return
|
||||
}
|
||||
|
||||
s0 := s[0]
|
||||
var parts []*cc.Initializer
|
||||
var isZero bool
|
||||
var fld cc.Field
|
||||
s, fld, parts, isZero = p.initializerUnionField(off, s, t)
|
||||
if len(s) != 0 {
|
||||
panic(todo("%v: internal error: %v", s0.Position(), t))
|
||||
if t.HasFlexibleMember() {
|
||||
p.err(s[0], "flexible array members not supported")
|
||||
return
|
||||
}
|
||||
|
||||
if isZero {
|
||||
p.w("%s%s%s{", initComment(s0, lm), tag, p.typ(s0, t))
|
||||
parts, isZero := p.initializerUnionField(off, s, t)
|
||||
if len(parts) == 0 || isZero {
|
||||
p.w("%s%s%s{", initComment(s[0], lm), tag, p.typ(s[0], t))
|
||||
p.w("%s}", initComment(parts[len(parts)-1], tm))
|
||||
return
|
||||
}
|
||||
|
||||
if fld0 := parts[0].FirstDesignatorField(); fld0 != nil && fld0.Index() != 0 {
|
||||
if fld0.IsBitField() || fld.IsBitField() {
|
||||
panic(todo(""))
|
||||
p.w("%sfunc() (r %s) {", tag, p.typ(parts[0], t))
|
||||
for _, part := range parts {
|
||||
var ft cc.Type
|
||||
fld := part.Field
|
||||
if fld != nil && fld.IsBitField() {
|
||||
}
|
||||
|
||||
fld := parts[0].Field
|
||||
if fld.IsBitField() {
|
||||
panic(todo(""))
|
||||
if ft == nil {
|
||||
ft = part.Type()
|
||||
}
|
||||
|
||||
// tag: *(*T)(unsafe.Pointer(&struct{f: ft; pad _[n]byte}{f: expr}))
|
||||
p.w("%s *(*%s)(unsafe.Pointer(&struct{f %s", tag, p.typ(s0, t), p.typ(s0, fld.Type()))
|
||||
if pad := t.Size() - fld.Type().Size(); pad != 0 {
|
||||
p.w("; _ [%v]byte", pad)
|
||||
}
|
||||
p.w("}{")
|
||||
p.initializerInner("f:", off+fld.Offset(), f, parts, fld.Type(), sc, tld, fld, lm, tm)
|
||||
p.w("}))")
|
||||
return
|
||||
}
|
||||
|
||||
p.w("%s%s%s{", initComment(s0, lm), tag, p.typ(s0, t))
|
||||
ft := fld.Type()
|
||||
tag = fmt.Sprintf("%s:", p.fieldName2(parts[0], fld))
|
||||
switch {
|
||||
case fld.IsBitField():
|
||||
first := true
|
||||
for _, v := range parts {
|
||||
if v.AssignmentExpression.Operand.IsZero() {
|
||||
continue
|
||||
if ft.Kind() == cc.Array {
|
||||
et := ft.Elem()
|
||||
switch {
|
||||
case isCharType(et):
|
||||
switch x := part.AssignmentExpression.Operand.Value().(type) {
|
||||
case cc.StringValue:
|
||||
str := cc.StringID(x).String()
|
||||
slen := uintptr(len(str)) + 1
|
||||
alen := ft.Len()
|
||||
switch {
|
||||
case alen < slen-1:
|
||||
p.w("copy(((*[%d]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&r))+%d)))[:], (*[%d]byte)(unsafe.Pointer(%s))[:])\n", alen, part.Offset-off, alen, p.stringLiteralString(str[:alen]))
|
||||
case alen < slen:
|
||||
p.w("copy(((*[%d]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&r))+%d)))[:], (*[%d]byte)(unsafe.Pointer(%s))[:])\n", alen, part.Offset-off, alen, p.stringLiteralString(str))
|
||||
default: // alen >= slen
|
||||
p.w("copy(((*[%d]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&r))+%d)))[:], (*[%d]byte)(unsafe.Pointer(%s))[:])\n", alen, part.Offset-off, alen, p.stringLiteralString(str+strings.Repeat("\x00", int(alen-slen))))
|
||||
}
|
||||
continue
|
||||
default:
|
||||
panic(todo("%v: %v <- %T", p.pos(part), et, x))
|
||||
}
|
||||
case p.isWCharType(et):
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
if !first {
|
||||
p.w("|")
|
||||
}
|
||||
first = false
|
||||
bitFld := v.Field
|
||||
bft := p.bitFileType(bitFld.BitFieldBlockWidth())
|
||||
p.w("%s%s", tidyComment("", v.AssignmentExpression), tag)
|
||||
tag = ""
|
||||
p.assignmentExpression(f, v.AssignmentExpression, bft, exprValue, fOutermost)
|
||||
p.w("&%#x", uint64(1)<<uint64(bitFld.BitFieldWidth())-1)
|
||||
if o := bitFld.BitFieldOffset(); o != 0 {
|
||||
ft = et
|
||||
}
|
||||
switch {
|
||||
case fld != nil && fld.IsBitField():
|
||||
bft := p.bitFileType(part, fld.BitFieldBlockWidth())
|
||||
p.w("*(*%s)(unsafe.Pointer(uintptr(unsafe.Pointer(&r))+%d)) |= ", p.typ(part, bft), part.Offset-off)
|
||||
p.assignmentExpression(f, part.AssignmentExpression, bft, exprValue, 0)
|
||||
p.w("&%#x", uint64(1)<<uint64(fld.BitFieldWidth())-1)
|
||||
if o := fld.BitFieldOffset(); o != 0 {
|
||||
p.w("<<%d", o)
|
||||
}
|
||||
default:
|
||||
p.w("*(*%s)(unsafe.Pointer(uintptr(unsafe.Pointer(&r))+%d)) = ", p.typ(part, ft), part.Offset-off)
|
||||
p.assignmentExpression(f, part.AssignmentExpression, ft, exprValue, 0)
|
||||
}
|
||||
default:
|
||||
p.initializerInner(tag, off+fld.Offset(), f, parts, ft, sc, tld, fld, lm, tm)
|
||||
p.w("\n")
|
||||
}
|
||||
comma := parts[len(parts)-1].TrailingComma()
|
||||
p.preCommaSep(comma)
|
||||
p.w(",")
|
||||
p.w("%s}", initComment(parts[len(parts)-1], tm))
|
||||
p.w("return r\n")
|
||||
p.w("}()")
|
||||
}
|
||||
|
||||
func (p *project) initializerUnionField(off uintptr, s []*cc.Initializer, t cc.Type) (r []*cc.Initializer, fld cc.Field, parts []*cc.Initializer, isZero bool) {
|
||||
r = s
|
||||
func (p *project) initializerUnionField(off uintptr, s []*cc.Initializer, t cc.Type) (parts []*cc.Initializer, isZero bool) {
|
||||
isZero = true
|
||||
fld = t.FieldByIndex([]int{0})
|
||||
nextOff := off + t.Size()
|
||||
for len(s) != 0 {
|
||||
if v := s[0]; v.Offset < nextOff {
|
||||
s = s[1:]
|
||||
parts = append(parts, v)
|
||||
if !v.AssignmentExpression.Operand.IsZero() {
|
||||
isZero = false
|
||||
}
|
||||
isZero = isZero && v.AssignmentExpression.Operand.IsZero()
|
||||
continue
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
return r[len(parts):], fld, parts, isZero
|
||||
return parts, isZero
|
||||
}
|
||||
|
||||
func compatibleStructOrUnion(t1, t2 cc.Type) bool {
|
||||
@ -494,7 +483,7 @@ func compatibleType(t1, t2 cc.Type) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (p *project) bitFileType(bits int) cc.Type {
|
||||
func (p *project) bitFileType(n cc.Node, bits int) cc.Type {
|
||||
switch bits {
|
||||
case 8:
|
||||
return p.task.cfg.ABI.Type(cc.UChar)
|
||||
@ -505,7 +494,7 @@ func (p *project) bitFileType(bits int) cc.Type {
|
||||
case 64:
|
||||
return p.task.cfg.ABI.Type(cc.ULongLong)
|
||||
default:
|
||||
panic(todo("%v: internal error: %v", bits))
|
||||
panic(todo("%v: internal error: %v", n.Position(), bits))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user