Page MenuHomeFreeBSD

Add __diagused
ClosedPublic

Authored by mjg on Jul 14 2021, 11:52 PM.
Tags
None
Referenced Files
F165409804: D31185.id92222.diff
Sat, Aug 8, 2:17 AM
F165406205: D31185.id92232.diff
Sat, Aug 8, 1:39 AM
Unknown Object (File)
Wed, Aug 5, 8:30 AM
Unknown Object (File)
Wed, Aug 5, 6:09 AM
Unknown Object (File)
Tue, Aug 4, 3:39 AM
Unknown Object (File)
Sun, Aug 2, 4:25 AM
Unknown Object (File)
Mon, Jul 20, 1:24 PM
Unknown Object (File)
Jun 27 2026, 6:56 PM
Subscribers
None

Details

Summary

This can be used for variables which are only used with either INVARIANTS or WITNESS. Without any annotation they run into dead store warnings from cc --analyze and blindly annotating with __unused may hide bad vars when it should not.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mjg requested review of this revision.Jul 14 2021, 11:52 PM
mjg created this revision.

The added macro is affected by symbols from the user namespace. This is actually a feature for kernel compilation environment. It should be put e.g. into sys/systm.h, not into the common header that must be usable in all environments. And in sys/systm.h, it should be under #ifdef _KERNEL.

After the move to kernel-only, there might be an issue if any code that is shared between kernel and userspace, starts using __diagused, but lets handle this when it become a real issue.

  • move to systm.h and hide under _KERNEL
This revision is now accepted and ready to land.Jul 15 2021, 1:32 PM
This revision was automatically updated to reflect the committed changes.