-
Notifications
You must be signed in to change notification settings - Fork 334
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
Issue warnings when an undefined header field is used #312
Comments
Hi Andy, |
@antoninbas can you elaborate on how the compiler option will work? Is the idea that the compiler generates a flag in context.json that enables/disables tracing in bmv2, or that the compiler generates the code to do the tracing? |
I'm talking about a bmv2 compile time flag for g++. Something like |
Makes sense to have a separate build configuration that one can enable if debugging such issues and not penalize all runs. I would actually keep the default be the performance build. |
Agreed that if there are strong performance concerns there that a build-time option at the time of building bmv2 is a good way to go. For such debug builds, an init-time option for warn or fatal error might be nice. For example, if someone used the debug build for automated regression runs, a fatal error might be nice for 'making more noise' about the potential problem than just a warning message and continuing. |
There are several places in the P4 v1.0.x and P4_16 draft specification where the behavior is allowed to be undefined. Ideally a compiler could perform static analysis and catch some or all of these, but there are concerns that such static analysis might always produce false positives. Although dynamic checking in the behavioral model is not guaranteed to find all such possible behavior, it could at least warn about cases experienced during actual tests.
In particular, warning when an undefined header field value is used would be a good start. I can create separate issues for other undefined behavior if there is interest.
Perhaps the default behavior should be to issue warnings when this occurs. Options to quiet the warnings, or to make them fatal errors, might be useful in some testing contexts.
The text was updated successfully, but these errors were encountered: