-
Notifications
You must be signed in to change notification settings - Fork 523
Enable build warnings/errors on Windows #831
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
src/h3lib/lib/coodijk.c: (73,10): warning C4244: '=': conversion from 'double' to 'int', possible loss of data (74,10): warning C4244: '=': conversion from 'double' to 'int', possible loss of data (133,25): warning C4244: '=': conversion from 'double' to 'int', possible loss of data (137,25): warning C4244: '=': conversion from 'double' to 'int', possible loss of data (236,13): warning C4307: '+': signed integral constant overflow src/h3lib/lib/localij.c: (633,14): warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data (634,14): warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data (635,14): warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data src/apps/testapps/testH3Memory.c: (84,21): warning C4098: 'test_prefix_free': 'void' function returning a value src/apps/testapps/testMathExtensionsInternal.c: (81,9): warning C4307: '-': signed integral constant overflow (82,9): warning C4307: '-': signed integral constant overflow (83,9): warning C4307: '-': signed integral constant overflow (84,9): warning C4307: '-': signed integral constant overflow (85,9): warning C4307: '-': signed integral constant overflow (86,9): warning C4307: '-': signed integral constant overflow (87,9): warning C4307: '-': signed integral constant overflow (88,9): warning C4307: '-': signed integral constant overflow (89,9): warning C4307: '-': signed integral constant overflow (90,9): warning C4307: '-': signed integral constant overflow (91,9): warning C4307: '-': signed integral constant overflow (92,9): warning C4307: '-': signed integral constant overflow (93,9): warning C4307: '-': signed integral constant overflow (94,9): warning C4307: '-': signed integral constant overflow (95,9): warning C4307: '-': signed integral constant overflow (96,9): warning C4307: '-': signed integral constant overflow (97,9): warning C4307: '-': signed integral constant overflow (98,9): warning C4307: '-': signed integral constant overflow (99,9): warning C4307: '-': signed integral constant overflow (100,9): warning C4307: '-': signed integral constant overflow (101,9): warning C4307: '-': signed integral constant overflow (102,9): warning C4307: '-': signed integral constant overflow (103,9): warning C4307: '-': signed integral constant overflow (104,9): warning C4307: '-': signed integral constant overflow (105,9): warning C4307: '-': signed integral constant overflow (106,9): warning C4307: '-': signed integral constant overflow src/apps/testapps/testCellToLocalIj.c: (204,44): warning C4146: unary minus operator applied to unsigned type, result still unsigned
Thanks for adding warnings-on-Windows! I'm not entirely certain why coveralls is reporting coverage fell, it might be because of changing the macro to an inline function. |
static inline bool ADD_INT32S_OVERFLOWS(int32_t a, int32_t b) { | ||
if (a > 0) { | ||
return INT32_MAX - a < b; | ||
} else { | ||
return INT32_MIN - a > b; | ||
} | ||
} |
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.
What is the purpose of these two changes? Do they actually affect the compiler warnings in some way?
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.
It's for suppressing the following warnings (that are listed in the description):
src/h3lib/lib/coodijk.c:
(236,13): warning C4307: '+': signed integral constant overflow
src/apps/testapps/testMathExtensionsInternal.c:
(81,9): warning C4307: '-': signed integral constant overflow
(82,9): warning C4307: '-': signed integral constant overflow
(83,9): warning C4307: '-': signed integral constant overflow
(84,9): warning C4307: '-': signed integral constant overflow
(85,9): warning C4307: '-': signed integral constant overflow
(86,9): warning C4307: '-': signed integral constant overflow
(87,9): warning C4307: '-': signed integral constant overflow
(88,9): warning C4307: '-': signed integral constant overflow
(89,9): warning C4307: '-': signed integral constant overflow
(90,9): warning C4307: '-': signed integral constant overflow
(91,9): warning C4307: '-': signed integral constant overflow
(92,9): warning C4307: '-': signed integral constant overflow
(93,9): warning C4307: '-': signed integral constant overflow
(94,9): warning C4307: '-': signed integral constant overflow
(95,9): warning C4307: '-': signed integral constant overflow
(96,9): warning C4307: '-': signed integral constant overflow
(97,9): warning C4307: '-': signed integral constant overflow
(98,9): warning C4307: '-': signed integral constant overflow
(99,9): warning C4307: '-': signed integral constant overflow
(100,9): warning C4307: '-': signed integral constant overflow
(101,9): warning C4307: '-': signed integral constant overflow
(102,9): warning C4307: '-': signed integral constant overflow
(103,9): warning C4307: '-': signed integral constant overflow
(104,9): warning C4307: '-': signed integral constant overflow
(105,9): warning C4307: '-': signed integral constant overflow
(106,9): warning C4307: '-': signed integral constant overflow
It seems that MSVC can't process ... ? ... : ...
correctly for this warning yet.
Co-authored-by: David Ellis <isv.damocles@gmail.com>
Adds `ENABLE_WARNINGS` to the build docs
set(H3_LINK_FLAGS "") | ||
option(ENABLE_WARNINGS "Enables compiler warnings" ON) | ||
if(ENABLE_WARNINGS) | ||
if(WIN32) |
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.
This is wrong, /W2
is a MSVC flag and you should check MSVC
instead. MSVC isn't the only Windows compiler available.
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.
Thanks for spotting! Would you mind filing an issue for this?
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.
Oh, sorry! I've opened an issue for this: #980
I'll open a PR too.
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.
src/h3lib/lib/coodijk.c:
src/h3lib/lib/localij.c:
src/apps/testapps/testH3Memory.c:
src/apps/testapps/testMathExtensionsInternal.c:
src/apps/testapps/testCellToLocalIj.c: