Could you please explain how I should manage this?
In general we use a lot of external libraries in our code and we don't want to analyze them.
How to avoid to get these kind of false negatives?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, understood. Anyway I think this is feasible only if the project uses just few functions from external libray, in my case I have a lot of callings to Zephyr functions, it'll be very hard to create such .cfg file.
Is it possibile to configure cppcheck to treat unknown functions as returning functions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
it seems that cppcheck 2.10.3 is failing in giving the missingReturn error in this simple function:
uint32_t test(void)
{
printk("Debug \n");
//return 10;
}
where printk is implemented in Zephyr OS.
printk()
is unknown to cppcheck, so it is assumed to be a noreturn function. This could be solved by creating a library file.Could you please explain how I should manage this?
In general we use a lot of external libraries in our code and we don't want to analyze them.
How to avoid to get these kind of false negatives?
Thanks
There are a couple of library files in
cppcheck/cfg/
already, but none of them containprintk
. You could create alinux.cfg
containingthen call
cppcheck --library=linux.cfg
Ok, understood. Anyway I think this is feasible only if the project uses just few functions from external libray, in my case I have a lot of callings to Zephyr functions, it'll be very hard to create such .cfg file.
Is it possibile to configure cppcheck to treat unknown functions as returning functions?
I don't think so. The relevant code is here: https://github.com/danmar/cppcheck/blob/518b6a27abbb5bb4b906600f39ee2cf390544449/lib/checkfunctions.cpp#L397