Skip to content

Conversation

@codomposer
Copy link

@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
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
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