Skip to content

convert: fix declarations after case label#67

Open
crudeboy776 wants to merge 1 commit into
torvalds:mainfrom
crudeboy776:fix/switch-case-declaration
Open

convert: fix declarations after case label#67
crudeboy776 wants to merge 1 commit into
torvalds:mainfrom
crudeboy776:fix/switch-case-declaration

Conversation

@crudeboy776

Copy link
Copy Markdown

This fixes a build failure with GCC/Clang where declarations directly after a case label are not valid in C.

Repro (Debian 11, GCC): make convert fails with:
error: a label can only be part of a statement and a declaration is not a statement

Also reproducible with clang on macOS.

Fix: wrap the 'p' case body in braces so the declarations are within a block scope.
Tested: make convert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant