You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec mentions in 7.1.3. The match kind type that,
The match_kind type is very similar to the error type and is used to declare a set of distinct names that may be used in a table's key property (described in Section 14.2.1). All identifiers are inserted into the top-level namespace. It is an error to declare the same match_kind identifier multiple times.
However, p4c fails to reject a case when there is duplicate match_kind, for example,
match_kind { foo, bar }
match_kind { foo }
A related test case exists as pipe.p4 in testdata/p4_16_samples.
#include <core.p4>
match_kind {
ternary,
exact
} // core.p4 already defines those two
Also, this is in contrast with how the p4c frontend handles duplicate error declarations. p4c rejects duplicate error declarations. For example, below program is rejected.
Both error and match_kind declarations should only appear in target arch includes, never in user programs, so these rules should really just be codifying what actual arhcitectures (try to) do.
Yes, but I believe it would be a good practice to have a dup-check for match_kinds as the frontend already does with error types, for the sake of checking the validity of arch files.
fruffy
added
the
p4-spec
Topics related to the P4 specification (https://github.com/p4lang/p4-spec/).
label
Jan 6, 2025
Yes, but I believe it would be a good practice to have a dup-check for match_kinds as the frontend already does with error types, for the sake of checking the validity of arch files.
I agree, the check should not be omitted just because architecture programmers are considered "more trusted".
The spec mentions in 7.1.3. The match kind type that,
However, p4c fails to reject a case when there is duplicate match_kind, for example,
A related test case exists as
pipe.p4
intestdata/p4_16_samples
.Also, this is in contrast with how the p4c frontend handles duplicate error declarations. p4c rejects duplicate error declarations. For example, below program is rejected.
The text was updated successfully, but these errors were encountered: