Page MenuHomeFreeBSD

Add __diagused
ClosedPublic

Authored by mjg on Jul 14 2021, 11:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 31, 5:37 PM
Unknown Object (File)
Sun, Mar 23, 4:53 AM
Unknown Object (File)
Sat, Mar 15, 8:07 AM
Unknown Object (File)
Feb 23 2025, 11:31 AM
Unknown Object (File)
Feb 9 2025, 10:49 PM
Unknown Object (File)
Feb 3 2025, 7:43 AM
Unknown Object (File)
Jan 24 2025, 9:56 AM
Unknown Object (File)
Jan 24 2025, 9:41 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.