From 0f164300b33f421468051a8815711503a34cd49c Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Fri, 10 Nov 2023 17:56:02 +0100 Subject: compiler: support const as int first argument This commit adds support for the following syntax: int8[constant] as an equivalent to: const[constant, int8] The goal is to have a unified const/flags definition that we can use in templates. For example: type template[CLASS, ...] { class int8:3[CLASS] // ... } type singleClassType template[SINGLE_CONST] type subClassType template[abc_class_flags] In this example, the CLASS template field can be either a constant or a flag. This is especially useful when defining both a generic instance of the template as well as specialized instances (ex. bpf_alu_ops and bpf_add_op). Signed-off-by: Paul Chaignon --- prog/encoding_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prog/encoding_test.go') diff --git a/prog/encoding_test.go b/prog/encoding_test.go index 032ba2e42..e2abacee1 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -273,8 +273,8 @@ func TestDeserialize(t *testing.T) { Err: `wrong type *prog.IntType for AUTO`, }, { - In: `test$bf2(&AUTO={AUTO, 0x10, 0x0})`, - Out: `test$bf2(&(0x7f0000000040)={0x8, 0x10, 0x0})`, + In: `test$bf2(&AUTO={AUTO, 0x10, 0x0, AUTO})`, + Out: `test$bf2(&(0x7f0000000040)={0x8, 0x10, 0x0, 0x18})`, }, { In: `test$str0(&AUTO="303100090a0d7022273a")`, -- cgit mrf-deployment