Opinion on Analyzer false positive

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().



I do not fully understand why you are getting the"garbage value" error message here. Looks like "flags.import" is getting initialized... Can you send the preprocessed file?



It does indeed look like B_TRUE and B_FALSE macros are undefined. I'll ask for help with FreeBSD folks as it isn't clear to me that this is an analyzer error.