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

Make fallthrough explicit in tok_parse.c #326

Merged
merged 2 commits into from
Jul 20, 2024
Merged

Conversation

r-barnes
Copy link
Contributor

In response to #325. Allows -Wimplicit-fallthrough to pass.

@@ -1558,6 +1558,9 @@ Tokenizer_handle_tag_close_close(Tokenizer *self)
Py_XDECREF(so);
Py_XDECREF(sc);
}
// One of `so` or `sc` failed to allocate so we fall through to clean up the
// closing tag and propagate the error by returning NULL.
__attribute__((fallthrough));
Copy link
Contributor

Choose a reason for hiding this comment

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

__attribute__((fallthrough)) is non-standard, IMO it would be better to use [[fallthrough]] if C23 is an option, or just duplicate the two lines below (Py_DECREF and return) to avoid the fallthrough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lahwaacz - __attribute__((fallthrough)) is present in GCC>=7 and LLVM>=8-10 (somewhere in there), so, although non-standard, it should be broadly available. C23 would work for me, but I'm not sure if you want that for your project.

Duplicating the lines seems simplest if you think that's a clean solution.

@earwig
Copy link
Owner

earwig commented Jul 19, 2024 via email

@r-barnes
Copy link
Contributor Author

@lahwaacz - I've duplicated the lines.

@coveralls
Copy link

Coverage Status

coverage: 99.201% (-0.002%) from 99.203%
when pulling 8c23031 on r-barnes:patch-1
into 4e73af2 on earwig:main.

@earwig
Copy link
Owner

earwig commented Jul 20, 2024

Thank you!

@earwig earwig merged commit 537e1e1 into earwig:main Jul 20, 2024
11 checks passed
@r-barnes r-barnes deleted the patch-1 branch July 22, 2024 20:26
@r-barnes
Copy link
Contributor Author

Thank you!

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.

4 participants