-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 Visual Studio 2017 warnings #788
Conversation
Can one of the admins verify this patch? |
|
||
#if defined(_MSC_VER) | ||
#pragma warning (pop) | ||
#endif |
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.
Could you please add a newline here?
test/CMakeLists.txt
Outdated
@@ -75,8 +75,11 @@ if(MSVC) | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") | |||
endif() | |||
|
|||
# Disable warning C4389: '==': signed/unsigned mismatch | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4389") | |||
# warning C4389: '==': signed/unsigned mismatch |
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.
Could you please add to the comment that these warnings are disabled?
Done and done! |
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.
Looks good to me.
In MSVC 2015, there is still one warning left, which does not seem to occur in MSVC 2017:
See https://ci.appveyor.com/project/nlohmann/json/build/2315/job/f15evu7h4lpcxog8 This is really strange. Do you have any ideas about this? |
The allocator used in this test always throws, so that code is indeed unreachable. It probably takes some really aggressive inlining to determine that. It could be that VS2017 isn't doing as much inlining as VS2015 in that particular area. It could also be that the unreachable code warning has been modified to allow code after an unconditional throw. |
@gregmarr Thanks, this makes sense. |
Thanks @jseward ! |
With this PR there should now be 0 warnings in Visual Studio 2017 /W4 when compiling all tests.