-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Inclusion of ArduinoJSON causes cppcheck to not recognize a call to a function #3797
Comments
Addendum: When I manually overwrite the files in |
I'm seeing the same issue on my end after following the reproduction steps. Strange 🤔 Isn't this a bug on cppcheck's end? Maybe would should mention this at https://sourceforge.net/p/cppcheck/discussion/ |
The question is whether it's an error in the way PlatformIO calls I'll oben a bugtracker ticket on https://trac.cppcheck.net/, since that's where it should end up.. The page says if "just" a forum post is opened it takes another person to actually create the ticket. |
I could further narrow it down to which part in ArduinoJson.h causes the defect: |
Cppcheck doesn't provide a proper report when one of the files in the check list is broken. If we run the analysis on a per-file basis, then Cppcheck will be able report at least defects from valid source files.
Hi @maxgerhardt ! Actually, the result when you include ArduinoJSON headers is the right one. Cppcheck is conifgured to analyze all source files in the As you mentioned, Cppcheck v2.1 works better in this case, but downgrading the package to v2.1 could possibly introduce even more issues for other projects because v2.3 contains several fixes for their preprocessor. The best we can do here is to at least report defects from files independently from broken ones. |
What kind of issue is this?
If you’ve found a bug, please provide an information below.
Configuration
Operating system: Win x64
PlatformIO Version (
platformio --version
):PlatformIO Core, version 5.0.5a1
Description of problem
Well, this is a weird one. See https://community.platformio.org/t/wrong-issues-from-cppcheck/18410.
At first, a project is created for an ESP32Dev board. Then, a
display.h
anddisplay.cpp
with two functions is added. Those two functions are called inmain.cpp
.Running the a check gives
However, if one does a
#include <ArduinoJson.h>
at the top, one getsSteps to Reproduce
pio run
pio check --skip-packages
to see that there are no defects#include <ArduinoJson.h>
inmain.cpp
pio check --skip-packages
Actual Results
Detected defects which are no defects since function is called in
main.cpp
Expected Results
No defects are found. Inclusion of a library does not change the workings of the cppcheck tool.
If problems with PlatformIO Build System:
All files found in reproduction project
Additional info
The text was updated successfully, but these errors were encountered: