Skip to content
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

Add empty block for trailing case(s) with no code. #4889

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

ChrisDodd
Copy link
Contributor

Per 12.7.3 in the spec, a trailing case label in a switch with no code is treated as if it has a {} after it; we were instead just removing it.

The main effect here is properly generate an error (later) if that case label is a duplicate, rather than silently removing it.

@jafingerhut
Copy link
Contributor

The updated expected output P4 programs look correct to me.

As far as I can tell, the new expected output files are all functionally equivalent to the old ones. Is there a test program we can add that has different packet in/out behavior without vs. with this compiler fix?

Copy link
Contributor

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fruffy fruffy added core Topics concerning the core segments of the compiler (frontend, midend, parser) run-validation Use this tag to trigger a Validation CI run. labels Aug 29, 2024
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
@ChrisDodd ChrisDodd added this pull request to the merge queue Sep 3, 2024
Merged via the queue into p4lang:main with commit acef8db Sep 3, 2024
18 checks passed
@ChrisDodd ChrisDodd deleted the cdodd-caseremoval branch September 3, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser) run-validation Use this tag to trigger a Validation CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants