[cfe-dev] Opinion on Analyzer false positive

Erik Cederstrand erik at cederstrand.dk
Thu Oct 25 01:32:26 PDT 2012


Anna,

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.

Erik

Den 25/10/2012 kl. 02.16 skrev Anna Zaks <ganna at apple.com>:

> Erik,
> 
> 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?
> 
> Thanks,
> Anna.
> On Oct 24, 2012, at 1:31 PM, Erik Cederstrand <erik at cederstrand.dk> wrote:
> 
>> 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
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 





More information about the cfe-dev mailing list