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 --- pkg/compiler/testdata/errors2.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/compiler/testdata/errors2.txt') diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt index e99610c58..e583094fa 100644 --- a/pkg/compiler/testdata/errors2.txt +++ b/pkg/compiler/testdata/errors2.txt @@ -369,6 +369,7 @@ foo$531(a ptr[in, const[0xffffffffffffffab, int8]]) foo$532(a ptr[in, const[0x7234567812345678, int64]]) foo$533(a ptr[in, const[0x12, int8:4]]) ### const val 0x12 does not fit into 4 bits foo$534(a ptr[in, flags[large_flags, int8]]) ### large_flags U16_MAX=0xffff doesn't fit into 8 bits +foo$535(a int64[no]) ### unknown flags no large_flags = U8_MAX, U16_MAX -- cgit mrf-deployment