svn commit: r334669 - head/sys/sys

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Jun 5 21:00:51 UTC 2018


--------
In message <1528232004.63685.25.camel at freebsd.org>, Ian Lepore writes:
>On Tue, 2018-06-05 at 20:34 +0000, Eric van Gyzen wrote:

>>   (((flags) & M_WAITOK) || _malloc_item != NULL)
>
>This is a sad sad thing. Treating (bits & flagconstants) as boolean has
>a long long history in C. Surely there are literally thousand of
>occurrances in freebsd code already, so why did this one get flagged?

FlexeLint also gets its knickers in a twist about this kind of construct
and as far as I can tell the origin of that particular interpretation
comes out of the MISRA C rules.

In FlexeLint that specific check can be disabled, and I would imagine
Coverity has a similar tweakable setting.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the svn-src-all mailing list