Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFixes Cppcheck warnings #1759
Fixes Cppcheck warnings #1759
Comments
|
PS: I don't know is this issue should be flagged as a feature request or as anything else, so I made it a regular issue. |
|
If I remove the warnings on non-explicit constructors (which are not a bug, but a feature for this library), we are left with the following issues:
PRs welcome! |
|
And even nicer than a PR fixes these issues would be adding the cppcheck to CI so that the codebase stays clean as well. |
|
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. |
|
Those 2 warnings:
seems to be false positive, since the expression can be true since their are initialize as such:
but cppcheck must deduce the warnings because of the default which is const too:
|
|
I have runned cppcheck on the version 3.7.3, the currently last release, and here are the warning that I have on a dummy project including the library through conan:
I'm currently creating a repository with a project able to run cppcheck on any version of I will update you when this repository will be ready to use |
|
Here is a little update on where I am on the correction of the cppcheck fixes I've finalize to repository on which I can run easily cppcheck with a simple program on jsonformoderncpp library, like any user of the library will do, and check if any warning is generated. You can find this repository here. With that tool now available, I've stated correcting one warning on a Fork : I will update you when I will have other news to give you about this |
|
Hi everyone ! Here is another update. To ignore those, cppcheck manual indicates that we can add comments in the code to do so, and when running cppcheck, we only have to add the option So I am going to make a Pull Request which will ignore all the warnings that must be ignored, to be able to focus on the last warning that need some code modifications. I will make a list of the warnings that are left once the Pull Request will have been created and merge |
|
@Xav83 Thanks for the update. Just to make sure: are you aware of the Makefile target |
|
@nlohmann Actually, I wasn't aware of it ! This is great, it will simplify a lot the process I used to fix the warnings |
|
@Xav83 Any news on this or can we close this? |
|
Hi @nlohmann ! The latest news was the Pull Request #1876 in which I detailed how what are the solutions that I know of, to suppress some warnings which are one false positive from cppcheck. I needed someone to validate which solution to integrate, or if another one is available, to finish having the library clear from cppcheck warnings |
Hi @nlohmann and other mainteners,
First of all, I must say that I love your work on this librairy.❤️
It feels really easy to use, and to read code using this library !
I have created this issue to talk about the warnings that cppcheck found on this project.
I'm currently experimenting with both this library and cppcheck on some little side projects. And doing so, I've ended up with cppcheck warnings me about some elements inside the json library.
So the purpose of this issue is to talk about the warnings from cppcheck, to address them when they are relevant, so that other people which are going to have both this library and cppcheck] in their project, as little as warnings as possible.
Here is the list of the warnings I've got for now:
Some of them may be false positive, but others can be relevant, so this is why I've made this issue. The good news, is that all the warnings I have got are flagged as "style", not as error or warning, so their are less likely to bother most of people using cppcheck.😄
If we successly correct all the warnings (and silence the false positive), we may even imagine adding cppcheck to the CI of the library.🤞
Let me know what you think about this idea. If you agree with the purpose of this issue, I'll gladly help to reach it.
For technical information, I've used the version 1.87 of cppcheck on the version 3.7.0 of the json library, on Windows, with Visual Studio 2017. You can find the repository on which I'm currently running this here
In a few minutes, I will also add a Pull Request which handles the warnings🔜
6and29.