-
Notifications
You must be signed in to change notification settings - Fork 274
Fix clang++'s warning about self-assign #2245
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ Author: Daniel Poetzl | |
#define SN_ASSERT_USE(v, b) SN_ASSERT(b) | ||
#else | ||
#define SN_ASSERT(b) | ||
#define SN_ASSERT_USE(v, b) v = v; | ||
#define SN_ASSERT_USE(v, b) static_cast<void>(v); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Casting to
Although I suppose as long as it works for the compilers we're actually using I guess it's good enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the full fix is to refactor the code so that this macro isn't necessary at all. There is a single use case at the moment, and a somewhat-dummy workaround would be adding a return value to the function. |
||
#endif | ||
|
||
// clang-format off | ||
|
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.
If the intention is to always mark
v
as used, it should also be done here.