Skip to content

fix: Parser fails with C23 label syntax#585

Closed
codomposer wants to merge 1 commit intoeliben:mainfrom
codomposer:fix/issue-576
Closed

fix: Parser fails with C23 label syntax#585
codomposer wants to merge 1 commit intoeliben:mainfrom
codomposer:fix/issue-576

Conversation

@codomposer
Copy link
Copy Markdown

@codomposer codomposer commented Nov 25, 2025

Summary

Fixes an issue where pycparser was reported to fail on C23-style empty labels such as a bare default: inside a switch.
The grammar already supports empty labels; this change adds a focused regression test to ensure that an empty default: is parsed correctly and remains supported.

Closes #576

Details

  • Extend TestCParser_whole_code.test_switch_statement in tests/test_c_parser.py with a new case:

    int foo(void) {
        int x = 0;
        switch (x) {
        default:
        }
        return 0;
    }

Contribution by Gittensor, learn more at https://gittensor.io/

Copy link
Copy Markdown
Owner

@eliben eliben left a comment

Choose a reason for hiding this comment

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

Such a test seems to already exist in test_case_empty_statement; is it different?

@codomposer
Copy link
Copy Markdown
Author

Such a test seems to already exist in test_case_empty_statement; is it different?

oh, I missed it,
I just wanted to resolve the issue
I'd like to contribute to the repository, can you please assign another issue which hasn't been resolved yet?

@codomposer codomposer closed this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser fails with C23 label syntax.

2 participants