-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
In response to earwig#325
@@ -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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Indeed, we can see this failed in the windows build: https://ci.appveyor.com/project/earwig/mwparserfromhell/builds/50247115/job/viq4v2m66hgv8878
Let’s duplicate the lines as suggested. I don’t think we can move to C23 yet.
|
@lahwaacz - I've duplicated the lines. |
Thank you! |
Thank you! |
In response to #325. Allows
-Wimplicit-fallthrough
to pass.