-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix a bunch of warnings #57
Conversation
3ce62b6
to
817edf6
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.
crnlib: fix -Wimplicit-const-int-float-conversion
looks really ugly. Seems like we'd be better off disabling this warning
I also dislike the crnlib: fix -Wmaybe-uninitialized
one. The assignment of dummy values which are never supposed to be used obscures the meaning of the code. Also it prevents sanitizer tools that can detect uninitialized memory use from uncovering possible bugs in the algorithm in the case that a value was unexpectedly not assigned.
crnlib/crn_assert.h
Outdated
|
||
#ifdef NDEBUG | ||
#define CRNLIB_ASSUME(p) | ||
#else | ||
#define CRNLIB_ASSUME(p) typedef crnlib_assume_try<sizeof(crnlib_assume_failure<(bool)(p)>)> CRNLIB_JOIN(crnlib_assume_typedef, __COUNTER__) |
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.
How about just replacing this with static_assert
? CRNLIB_ASSUME is a pre-C++11 implementation for static assertions.
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.
Just doing this?
#define CRNLIB_ASSUME(p) static_assert(p, "")
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.
yes
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.
Now done.
817edf6
to
59ea6ae
Compare
59ea6ae
to
6d89d38
Compare
This is about warnings like that:
I guess this MSVC warning spammed in MSVC AppVeyor CI is the same one:
|
I looked at that commit closer and it is actually completely wrong. For example in
The condition is equivalent to |
6d89d38
to
64e3c3f
Compare
Right, this is stupid indeed! I rewrote that commit by doing |
64e3c3f
to
6c956c4
Compare
crnlib/crn_assert.h
Outdated
@@ -39,15 +39,7 @@ struct crnlib_assume_failure<true> { | |||
template <int x> | |||
struct crnlib_assume_try {}; |
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.
More CRNLIB_ASSUME bits that can be deleted above
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.
Done.
6c956c4
to
3642119
Compare
As I said earlier I don't think it's an improvement to treat |
3642119
to
f3aa8ad
Compare
Thanks, I now removed this one. |
f3aa8ad
to
d36ab74
Compare
Fix a bunch of warnings, also delete an unused macro.