[cfe-dev] Opinion on Analyzer false positive
Erik Cederstrand
erik at cederstrand.dk
Wed Oct 24 13:31:24 PDT 2012
Hi guys,
The Static Analyzer spits out this report on some ZFS code http://scan.freebsd.your.org/freebsd-head/WORLD/2012-10-24-amd64/report-uH6BjZ.html#EndPath
The code is OK in my opinion because the default return value for getopt(3) is '?': http://www.unix.com/man-page/posix/3posix/getopt/
I could change the '?' case to 'default:' but this is a pretty common pattern (plus, it's not our own code). Is it possible to create a special case for getopt() in the Analyzer? It would require splitting the input string to getopt() to restrict the possible return values of getopt().
Thanks,
Erik
More information about the cfe-dev
mailing list