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
Static errors in the C codebase #2474
Comments
Hi @AlessandroG09 !
That definitely looks like a typo. I suspect this code never gets used, so the error didn't show up before.
That just means the cppcheck doesn't understand how //the IP address for the shield:
static uint8_t ip[] = { W5100_IP }; Normally
Again, one of the defines wasn't found so the checker assumed 0. These are normally defined in the build process, in the generated makefiles and headers.
This might be a problem, although we were using this code in the past and it worked as expected - so perhaps we were lucky with the undefined behavior.
The values are defined as int_64, so I think the checker here just assumes we have 32-bit ints, but the compiler actually figures out they are 64-bit. Hence a false positive.
Not sure about this one. @gautierhattenberger what do you think? @AlessandroG09 we had similar false positives previously with coverity scan - I think the main challenge for all those checkers is that paparazzi generates lots of code (mostly Makefiles and headers) dynamically, depending on your configuration. So having a checker test the generated code and flag errors and warnings there would be the most useful. Not sure if that is something you would want to try for your course project? |
@AlessandroG09 If I would be your, I'll differentiate between airborne code and Ground Tools only use for specific hardware etc. Thanks any how for you effort in possibly making PPRZ even more robust 👍 |
It might actually be a real possible error when running on a 32bits arch. I need to check but it might be easy to solve with something like |
I run a check of the C codebase with cppcheck as part of one of my University's course projects. Below, the relevant errors that cppcheck found. Each set of similar errors is enclosed in a quote.
I think this might be just a typo? Since I see the matrix is 6 cells for 6 cells.
Arrays count from zero, so, if the intent was to access that single value stored into ip[], shouldn't it be ip[0] instead of ip[1]?
I hope to be of help reporting this errors.
The text was updated successfully, but these errors were encountered: