mirror of
https://github.com/golang/go
synced 2024-11-19 02:24:41 -07:00
go.tools/pointer: suppress warnings from unsafe.Pointer conversions in the "syscall" package.
This is a short-term usability measure. Longer term, we need to audit each conversion to decide whether it should be ignored or modelled by an analytic summary. R=crawshaw CC=golang-dev https://golang.org/cl/13263050
This commit is contained in:
parent
d38c09ed22
commit
7a5597c226
@ -450,9 +450,14 @@ func (a *analysis) genConv(conv *ssa.Convert) {
|
|||||||
case *types.Pointer:
|
case *types.Pointer:
|
||||||
// unsafe.Pointer -> *T? (currently unsound)
|
// unsafe.Pointer -> *T? (currently unsound)
|
||||||
if utSrc == tUnsafePtr {
|
if utSrc == tUnsafePtr {
|
||||||
a.warnf(conv.Pos(),
|
// For now, suppress unsafe.Pointer conversion
|
||||||
"unsound: %s contains an unsafe.Pointer conversion (to %s)",
|
// warnings on "syscall" package.
|
||||||
conv.Parent(), tDst)
|
// TODO(adonovan): audit for soundness.
|
||||||
|
if conv.Parent().Pkg.Object.Path() != "syscall" {
|
||||||
|
a.warnf(conv.Pos(),
|
||||||
|
"unsound: %s contains an unsafe.Pointer conversion (to %s)",
|
||||||
|
conv.Parent(), tDst)
|
||||||
|
}
|
||||||
|
|
||||||
// For now, we treat unsafe.Pointer->*T
|
// For now, we treat unsafe.Pointer->*T
|
||||||
// conversion like new(T) and create an
|
// conversion like new(T) and create an
|
||||||
|
Loading…
Reference in New Issue
Block a user