-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification over emits inside if statements #1338
Comments
The language spec does not forbid It would be best if an implementation that does not support them document this, and that its back end reject programs that attempt to use them. I would recommend filing a bug in the https://github.com/p4lang/p4c repository that includes:
The most reasonable possible fixes for the EBPF back end would be one of: (a) reject the program with an error that such |
Thank you for the reply.
Okk, opened the issue
In the case of (a), would it be ok to just reject if statements with emits inside, or should it just flat out reject any if statements? |
I would recommend supporting the largest subset of possible programs that is reasonable to implement for whoever is doing the implementation, and reject all other programs. |
In the deparser's apply block, are packet emits inside if statements allowed?
For example, something like the following:
The spec shows uses of if statements inside the deparser's apply block, so I'm assuming that is fine. However, there is nothing specifically mentioning emits.
The question arose because we tried to compile the example above using the ebpf backend, but the generated code was buggy.
It compiled:
to an empty if statement:
and completely ignored the emit for the ethernet header
The text was updated successfully, but these errors were encountered: