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

Switch case with ranges #1055

Open
sparkforreg opened this issue Jan 7, 2024 · 2 comments
Open

Switch case with ranges #1055

sparkforreg opened this issue Jan 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@sparkforreg
Copy link

Is it a bug that case with a range is not translated correctly?

here is a c code example

switch(5) {
case 3 … 7 : print(“1”);
default: print(“2”);
}

@fw-immunant
Copy link
Contributor

This isn't a bug per se, but a reasonable enhancement request--we don't yet support this nonstandard extension to C.

I hadn't realized this extension existed, but it seems widely supported (by GCC, Clang, and Sun's compilers at least) so it might be worth handling. Doing so would involve checking caseStmtIsGNURange when processing the Clang AST and probably rejiggering our CStmtKind enum a bit to be able to carry the information needed for range case statements.

@fw-immunant fw-immunant added the enhancement New feature or request label Jan 8, 2024
@sparkforreg
Copy link
Author

thanks for checking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants