-
Notifications
You must be signed in to change notification settings - Fork 206
enable -Wconversion and -Wsign-conversion by default #204
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
I also disable the warnings in the mpi tests, but this is code we might not want to touch? |
@sjaeckel Note that the only changes are to the tests, no changes to the library code. |
Does not build cleanly on travis. It did on my machine, I have to check. |
Fortunately we have this nice travis setup which tests the different configuration 👍 Fix is on the way. |
@sjaeckel About these warnings - you have to say if we really want them activated in the case of MP_8BIT and MP_16BIT since in those cases the code gets quite a bit uglier. The issue is that mp_word is smaller than int and every calculation is promoted to int which would result in many casts and for example the My recommendation would be to activate the warnings only for sizeof(mp_word) >= 4 cases. What do you think? |
I am trying this. Let's see. |
@sjaeckel It works like this. Squashed and rebased. |
endif | ||
|
||
ifdef NO_CONV_WARNINGS | ||
CFLAGS += -Wsystem-headers |
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.
why not keep them enabled by default?
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.
There are conversion warnings in the system headers unfortunately. I also don't think Wsystem-headers is particularly useful since we cannot do anything about those issues. I never activate these warnings since they are only intended for people working on the system headers it seems.
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.
But with NO_CONV_WARNINGS=1 for the 16 and 8 bit builds we also have the warnings activated at least sometimes in the CI, which is better than nothing :)
* no changes to the library code * conversion issues in the demo testsuite fixed * disable warnings in mtest since we do not want to touch mpi code * add NO_CONV_WARNINGS and disable the warnings for 8 and 16bit limbs (many warnings due to int promotion if mp_word is smaller than int) * disable Wsystem-headers if Wconversion is enabled, to avoid warnings from the system headers
@sjaeckel rebased! |
@minad My Travis is not yet running, so you still might make it first! ;-) |
Hmm, for some reason the build is failing again :( |
I guess it is because of xenial. Did the compiler version change? |
Now it is gcc 5.4, before that it was 4.8. |
Took a closer look. You can try with some more casting inside the bit-pushing but I fear a complete change to
Should not matter. Only the other way around or if it is a known bug and this warning is correct, not a bug. But that 4.8 did not recognise it is good to know because it is my default GCC, too, so I need to do the checks with a younger one. |
Hmm, I am a bit inclined to give up. On my systems I am using much newer compilers (gcc 7 or 8) and very recent clangs, where these issues don't occur anymore. My interest in fighting old compilers is very limited. I think this PR only makes sense if no heavy changes to the code are needed. For example I've read that the issue won't occur if you store the right side of |
Should we probably simply update gcc on Travis? |
My favorite solution would be to test against multiple gcc and clang versions. For example gcc 6, 7, 8 and clang 5, 6, 7. It is the question if you want to blow up the build matrix or just pick out the demo test and only build this one against multiple versions. |
To test the standard build with all those versions should suffice IMO |
Let's keep this PR open until #208 is resolved. |
xenial (Ubuntu 16.04) with GCC 5.4 is a LTS and ends in 2021. We might get more restrictive but at least the LTS distributions of the Big Players(TM) have to be supported. Ubuntu 14.04 LTS runs out this month (which runs on this machine, argh!) so GCC 4.8 can fall out if necessary. |
Enable together with Wconversion warnings in #204 with -Wno-system-headers!
Enable together with Wconversion warnings in #204 with -Wno-system-headers!
closed via #225 |
disable -Wsystem-headers