Page MenuHomeFreeBSD

Add __diagused
ClosedPublic

Authored by mjg on Jul 14 2021, 11:52 PM.
Tags
None
Referenced Files
F102679291: D31185.diff
Fri, Nov 15, 6:37 PM
Unknown Object (File)
Thu, Oct 24, 3:08 AM
Unknown Object (File)
Tue, Oct 22, 3:58 PM
Unknown Object (File)
Mon, Oct 21, 5:42 AM
Unknown Object (File)
Sun, Oct 20, 6:26 AM
Unknown Object (File)
Sep 22 2024, 4:26 PM
Unknown Object (File)
Sep 13 2024, 6:03 PM
Unknown Object (File)
Sep 5 2024, 3:57 AM
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.