aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/compiler.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-11-15 15:39:13 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-11-18 09:29:33 +0000
commit4efd46f20fcf44af31c81f62f562cecb50653451 (patch)
tree3385f25e14803ab09044c5d481a0ca3a9125d7c6 /pkg/compiler/compiler.go
parentcfe3a04a188eb9a2c407783d8d6e6f55a4b30886 (diff)
pkg/compiler: allow recursion via arrays
Permit structs to recursively contain itself in arrays. This is needed for netlink. Amusingly several netlink policies contain itself.
Diffstat (limited to 'pkg/compiler/compiler.go')
-rw-r--r--pkg/compiler/compiler.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
index 3f10ae5fe..978255219 100644
--- a/pkg/compiler/compiler.go
+++ b/pkg/compiler/compiler.go
@@ -65,6 +65,7 @@ func createCompiler(desc *ast.Description, target *targets.Target, eh ast.ErrorH
structVarlen: make(map[string]bool),
structTypes: make(map[string]prog.Type),
structFiles: make(map[*ast.Struct]map[string]ast.Pos),
+ recursiveQuery: make(map[ast.Node]bool),
builtinConsts: map[string]uint64{
"PTR_SIZE": target.PtrSize,
},
@@ -135,11 +136,12 @@ type compiler struct {
usedTypedefs map[string]bool
brokenTypedefs map[string]bool
- structVarlen map[string]bool
- structTypes map[string]prog.Type
- structFiles map[*ast.Struct]map[string]ast.Pos
- builtinConsts map[string]uint64
- fileMeta map[string]Meta
+ structVarlen map[string]bool
+ structTypes map[string]prog.Type
+ structFiles map[*ast.Struct]map[string]ast.Pos
+ builtinConsts map[string]uint64
+ fileMeta map[string]Meta
+ recursiveQuery map[ast.Node]bool
}
type warn struct {