-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-120017: use 'do-while(0)' in some {codegen,compile}.c
multi-line macros
#120018
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
Conversation
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.
The diff could be minimized, for example:
-#define RETURN_IF_ERROR_IN_SCOPE(C, CALL) { \
+#define RETURN_IF_ERROR_IN_SCOPE(C, CALL) do { \
if ((CALL) < 0) { \
compiler_exit_scope((C)); \
return ERROR; \
} \
-}
+} while (0)
On other hand, this is an opportunity to vertically align line continuation characters as recommended by PEP 7. I am not sure that this is a good reason to do this, it is better to ask anybody who currently regularly works with this code.
I don't have a preference. Happy with either way. |
Actually, in another PR, I was asked to indent it. And other constructions seem to indent the do and the while as well. I also think it's a bit closer to how we write functions in the rest of the code, namely with I tried to be consistent and only align the line continuations if it's new code (note that most of the time, line continuations were already aligned so, I just continued with the existing style, lucky me). |
{codegen,compile}.c
multi-line macros
For the review, it's easier to check the diff by hiding the whitespace changes (also, could someone add the
skip news
label, please?)do { ... } while(0)
in{codegen,compile}.c
#120017