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)
Wed, Jul 2, 1:53 PM
Unknown Object (File)
May 13 2025, 5:40 PM
Unknown Object (File)
Apr 19 2025, 6:14 PM
Unknown Object (File)
Apr 19 2025, 6:06 PM
Unknown Object (File)
Apr 19 2025, 4:53 PM
Unknown Object (File)
Feb 24 2025, 7:23 AM
Unknown Object (File)
Feb 21 2025, 8:29 PM
Unknown Object (File)
Feb 21 2025, 4:58 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.