aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-03-31 13:29:37 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-03-31 15:28:17 +0200
commit8950ec3f515f09db0af2c02deff1f5cc5cf9e8e2 (patch)
tree33b92cf5be96d8bd2d95bd194f65f864424682aa
parent22968402ee0f2730aa5f517e317ff7170f6e6942 (diff)
prog: add MaxArgs const
Move the const from the compiler. In preparation for future changes.
-rw-r--r--pkg/compiler/check.go5
-rw-r--r--prog/types.go4
2 files changed, 6 insertions, 3 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go
index 7f12d74a5..63268af73 100644
--- a/pkg/compiler/check.go
+++ b/pkg/compiler/check.go
@@ -146,7 +146,6 @@ func (comp *compiler) checkNames() {
}
func (comp *compiler) checkFields() {
- const maxArgs = 9 // executor does not support more
for _, decl := range comp.desc.Nodes {
switch n := decl.(type) {
case *ast.Struct:
@@ -160,9 +159,9 @@ func (comp *compiler) checkFields() {
case *ast.Call:
name := n.Name.Name
comp.checkFieldGroup(n.Args, "argument", "syscall "+name)
- if len(n.Args) > maxArgs {
+ if len(n.Args) > prog.MaxArgs {
comp.error(n.Pos, "syscall %v has %v arguments, allowed maximum is %v",
- name, len(n.Args), maxArgs)
+ name, len(n.Args), prog.MaxArgs)
}
}
}
diff --git a/prog/types.go b/prog/types.go
index c83a2875d..7b4ec53e8 100644
--- a/prog/types.go
+++ b/prog/types.go
@@ -21,6 +21,10 @@ type Syscall struct {
outputResources []*ResourceDesc
}
+// MaxArgs is maximum number of syscall arguments.
+// Executor also knows about this value.
+const MaxArgs = 9
+
type Dir int
const (