Skip to content
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

Treat MSVC warnings as errors #2930

Merged
merged 5 commits into from
Aug 13, 2021
Merged

Treat MSVC warnings as errors #2930

merged 5 commits into from
Aug 13, 2021

Conversation

nlohmann
Copy link
Owner

This PR is a follow up to #2924 and treats all MSVC warnings as errors.

@nlohmann nlohmann self-assigned this Aug 13, 2021
@nlohmann nlohmann marked this pull request as draft August 13, 2021 10:47
@nlohmann nlohmann mentioned this pull request Aug 13, 2021
@coveralls
Copy link

coveralls commented Aug 13, 2021

Coverage Status

Coverage remained the same at 100.0% when pulling 4b0e04e on msvc_warnings_as_error into 910fabf on develop.

@nlohmann nlohmann marked this pull request as ready for review August 13, 2021 12:37
@nlohmann nlohmann added this to the Release 3.9.2 milestone Aug 13, 2021
@@ -100,6 +100,9 @@ struct my_allocator : std::allocator<T>
std::allocator<T>::deallocate(p, n);
}

// the code below warns about p in MSVC 2015 - this could be a bug
Copy link
Contributor

Choose a reason for hiding this comment

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

"C4100 can also be issued when code calls a destructor on a otherwise unreferenced parameter of primitive type. This is a limitation of the Microsoft C++ compiler."
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4100?view=msvc-160

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks, I fixed it.

@@ -809,6 +809,10 @@ TEST_CASE("an incomplete type does not trigger a compiler error in non-evaluated
static_assert(!is_constructible_patched<json, incomplete>::value, "");
}

// the code below warns about t in MSVC 2015 - this could be a bug
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
Copy link
Contributor

Choose a reason for hiding this comment

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

Same class of error as the other one, sizeof(t) is a compile-time constant based only on T, not on the value of t.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks, I also fixed it.

@nlohmann nlohmann merged commit 6ac037c into develop Aug 13, 2021
@nlohmann nlohmann deleted the msvc_warnings_as_error branch August 13, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants