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
F81612832: D32861.id.diff
Thu, Apr 18, 11:24 PM
Unknown Object (File)
Thu, Apr 11, 1:55 PM
Unknown Object (File)
Sun, Apr 7, 6:54 PM
Unknown Object (File)
Mar 9 2024, 9:09 AM
Unknown Object (File)
Feb 14 2024, 4:27 AM
Unknown Object (File)
Nov 17 2023, 11:39 PM
Unknown Object (File)
Nov 17 2023, 10:09 PM
Unknown Object (File)
Nov 17 2023, 8:46 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.