From b720d0fe3c82f726922714b1e9603119e933ad3a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 4 Jan 2022 16:02:51 +0100 Subject: prog: require stricter resource constructors This is prog counter-part of the "pkg/compiler: require stricter resource constructors" commit. --- prog/resources.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prog/resources.go b/prog/resources.go index 5af129d00..7c7fa1770 100644 --- a/prog/resources.go +++ b/prog/resources.go @@ -46,7 +46,13 @@ func (target *Target) populateResourceCtors() { // Find resources that are created by each call. callsResources := make([][]*ResourceDesc, len(target.Syscalls)) ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) { + if typ.Optional() { + ctx.Stop = true + return + } switch typ1 := typ.(type) { + case *UnionType: + ctx.Stop = true case *ResourceType: if ctx.Dir != DirIn { callsResources[ctx.Meta.ID] = append(callsResources[ctx.Meta.ID], typ1.Desc) -- cgit mrf-deployment