-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Ignores some cppcheck warnings #1876
Conversation
…tructor with one parameter in json.hpp.
…tructor with one parameter in output_adapters.hpp.
…tructor with one parameter in json_ref.hpp.
…tructor with one parameter in input_adapters.hpp.
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.
I honestly do not really like these changes. Instead of marking every single constructor, I would rather set the respective command-line argument to the make cppcheck
target.
Hi @nlohmann 😃 First of all, thanks for your interest in this Pull Request. 👍 I agree with you that this is not something really elegant. There are other ways to suppress warnings in cppcheck, detailed in the manual. We can suppress each warnings in the command line and given this line to the cppcheck users. We can create a text file, or a xml file in which the ignored warning will be detailed and given to cppchek, so that it won't trigger them. If this solution is used, then, it should be well described in the README, to make it easy for the cppcheck users to integrate this file in their workflow(since they can integrate it from conan, or as a cmake external project, for example). I would happily modify this PR to use another solution. 😃 Thank you in advance 🙂 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@Xav83 I went ahead and reviewed it |
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.
you may have to fix line 386
@@ -374,6 +380,7 @@ class input_adapter | |||
std::is_integral<typename std::remove_pointer<CharT>::type>::value and | |||
sizeof(typename std::remove_pointer<CharT>::type) == 1, | |||
int>::type = 0> | |||
// cppcheck-suppress noExplicitConstructor | |||
input_adapter(CharT b) | |||
: input_adapter(reinterpret_cast<const char*>(b), | |||
std::strlen(reinterpret_cast<const char*>(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.
this is the reason why
This Pull Request adds comments made so that, when using
inline-suppr
option, cppcheck will ignore the warnings about not using explicit keyword when a constructor has one parameter.It addresses some of the warnings in #1759
Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filesingle_include/nlohmann/json.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.