Page MenuHomeFreeBSD

kmod: build with INVARIANTS for clang-analyzer
Needs ReviewPublic

Authored by kevans on Nov 5 2021, 10:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 20, 5:13 PM
Unknown Object (File)
Mon, Oct 20, 5:13 PM
Unknown Object (File)
Mon, Oct 20, 3:32 AM
Unknown Object (File)
Tue, Oct 14, 12:28 AM
Unknown Object (File)
Sun, Oct 12, 5:34 AM
Unknown Object (File)
Sep 20 2025, 9:15 PM
Unknown Object (File)
Sep 19 2025, 2:41 PM
Unknown Object (File)
Sep 15 2025, 11:28 PM
Subscribers

Details

Reviewers
mjg
emaste
jhb
Summary

INVARIANTS sometimes informally documents some of the less obvious
assumptions that trip up clang --analyze with a path into a __dead2
function. Turning it on doesn't affect much else, so let's do it.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42622
Build 39510: arc lint + arc unit

Event Timeline

This is going to hide a host of write-only or straight up unused vars when the kernel is built without invariants.

If anything the thing to do here is to rework all the assert macros to expand to __builtin_unreachable if the asserted condition does not hold. However, that's quite a churn.

In D32861#741789, @mjg wrote:

This is going to hide a host of write-only or straight up unused vars when the kernel is built without invariants.

If anything the thing to do here is to rework all the assert macros to expand to __builtin_unreachable if the asserted condition does not hold. However, that's quite a churn.

[Phabricator is magic]. I don't see how you intend to do that, either, if the very act of observing the write-only var is enough to kill it.