Den mån 26 aug. 2024 kl 00:14 skrev Tom Smyth <tom.sm...@wirelessconnect.eu>: > Folks, > Im just wondering what other porters experience of scan-build for the > projects that you are maintaining ? > has it been useful in identifying bugs?... or is the analysis engine too > basic or shallow to properly analyse code ?
When I run it on "openbsd" code, the things it finds are often super deep, requiring 37 steps and that syscalls or libc calls return 0 when they can't and then figuring out 36 steps later that if they did, then a bug could appear. Like this I ran over got a long time ago. http://c66.it.su.se:8080/obsd/2019-10-25/scan-build-2019-10-25-192004-30128-1/report-f36c08.html#EndPath The creation of dirs is probably a "side-effect" that it can't track and hence it thinks you could call "make_parent_dirs_something()", return without err being set, and still fail later because it doesn't know how it would work. This is probably because obsd devs are mostly very experienced in knowing the environment they run in and not producing crap code generally, but I think scan-build would find a lot of super easy bugs if we ran it over generic 1995 C code of the time. It does find trivial things like http://c66.it.su.se:8080/obsd/2019-10-25/scan-build-2019-10-25-192004-30128-1/report-36d1ed.html#EndPath > are there particular types of bugs it is good at identifying without false > positives ? > are there particular types of bugs that it identifies that are probably a > waste of time ? > any advice on using scan-build-16 with ports would be appreciated... I like browsing over the html pages and following the things it does find. I'm sure over larger sources, it could pick up a lot of things that need fixing. The trivial thing above might just be writing to a counter for which you later plan to actually use, but for now scan-build will think it is a serious error you should handle. -- May the most significant bit of your life be positive.