Closed GoogleCodeExporter closed 9 years ago
The warnings from the generated code may be difficult to fix. In a way, lint is
correct, because the pointer hacks in the pb_field_t are quite intricate.
On the other hand the warnings from main nanopb code should probably be fixed.
I'm still marking this as enhancement, as there is no functional nor
compilation problem caused because of these.
Original comment by Petteri.Aimonen
on 1 Sep 2012 at 7:53
Hmm, what lint (splint?) settings are you using, if you get so few warnings?
With the default settings, splint spits a screenfull of useless stuff at me:
pb_decode.c:464:136: Only storage iter.current (type pb_field_t *) derived from
variable declared in this scope is not released (memory leak)
pb_decode.c:464:136: Only storage iter.dest_struct (type void *) derived from
variable declared in this scope is not released (memory leak)
pb_decode.c:464:136: Only storage iter.pData (type void *) derived from
variable declared in this scope is not released (memory leak)
pb_decode.c:464:136: Only storage iter.pSize (type void *) derived from
variable declared in this scope is not released (memory leak)
I'm not going to litter the code with lint directives. And I can see nothing
wrong with most of the splint warnings and no way to change the code to avoid
them. Heck, a memory leak in a function that doesn't allocate anything, ever?
I fixed the pb_encode.c:272 (uint64_t) cast. It is there only because someone
reported that his compiler didn't automatically convert 32-bit types to 64-bit
types when used as function arguments.
Regarding the & before function names to take a pointer: in my opinion it is
much clearer to use & to mark a function pointer. Therefore I'm not going to
change it just for splint.
For now, I don't think splint is that useful for checking nanopb code. I of
course welcome any patches that cleanly avoid the warnings.
Original comment by Petteri.Aimonen
on 2 Sep 2012 at 5:22
im not really sure what lint / splint settings we use. i think that a lot of
times lint gives bogus warnings anyway. I dont see any problem with you marking
tjis as wont fix, we can just turn off lint for nanopb.
thanks!
Original comment by jone...@jonesmz.com
on 2 Sep 2012 at 5:28
Original comment by Petteri.Aimonen
on 2 Sep 2012 at 5:45
Original issue reported on code.google.com by
jone...@jonesmz.com
on 31 Aug 2012 at 8:48