-
Notifications
You must be signed in to change notification settings - Fork 902
ompi: rename assert variables to mpi_assert #8591
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
ompi: rename assert variables to mpi_assert #8591
Conversation
There already exists an identifier with the name assert. It is not appropriate to use this name for variables in C. This commit changes these variable names to mpi_assert. This should address an issue where clang-format gives the wrong result when doing bit-wise-and operations on these variables. Signed-off-by: Nathan Hjelm <[email protected]>
9387dab
to
aaabe3d
Compare
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.
I'm amazed the compiler would let people get away with it!
bot:aws:retest one more time... |
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.
Fine with me since it works around an issue with clang-format.
For the record: using assert
as a variable name is perfectly. The C assert is a function-like macro that is only expanded when called. Otherwise the pre-compiler will not touch it. See https://gcc.gnu.org/onlinedocs/cpp/Function-like-Macros.html
@devreal That makes sense. Wasn't sure how it is defined but the C11 standard clearly says |
Not sure what is going on with the build checker. Kicking it again bot:aws:retest |
@hjelmn There is a |
@awlauria That sounds like a good idea. Generally, shadowing leads to inadvertent errors. If gcc is not already warning we should turn that on. |
Though thinking about it |
Yeah unfortunately it won't pick up the assert() case, but still a good thing to scrub. |
Ugh. The build checker is busted. |
Looked the build checker and everything worked fine except for a random failure in the clang38 workflow. Not related to this change. |
There already exists an identifier with the name assert. It is not
appropriate to use this name for variables in C. This commit changes
these variable to mpi_assert. This should address an issue where
clang-format gives the wrong result when doing bit-wise operations on
these variables.
Signed-off-by: Nathan Hjelm [email protected]