+
Skip to content

Conversation

kou
Copy link
Contributor

@kou kou commented Apr 25, 2024

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

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
@coveralls
Copy link

coveralls commented Apr 25, 2024

Coverage Status

coverage: 98.824% (-0.003%) from 98.827%
when pulling 5a6cea4 on kou:windows-warning
into afaa41a on uber:master.

@isaacbrodsky
Copy link
Collaborator

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.

Comment on lines +32 to +38
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;
}
}
Copy link
Collaborator

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?

Copy link
Contributor Author

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>
@isaacbrodsky isaacbrodsky merged commit c6c6850 into uber:master Apr 28, 2024
isaacbrodsky added a commit that referenced this pull request Apr 28, 2024
Adds `ENABLE_WARNINGS` to the build docs
isaacbrodsky added a commit that referenced this pull request Apr 28, 2024
Adds `ENABLE_WARNINGS` to the build docs
@kou kou deleted the windows-warning branch April 29, 2024 02:47
set(H3_LINK_FLAGS "")
option(ENABLE_WARNINGS "Enables compiler warnings" ON)
if(ENABLE_WARNINGS)
if(WIN32)
Copy link

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.

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载