Page MenuHomeFreeBSD

Add __diagused
ClosedPublic

Authored by mjg on Jul 14 2021, 11:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 4 2024, 8:11 PM
Unknown Object (File)
Dec 4 2024, 8:11 PM
Unknown Object (File)
Dec 4 2024, 8:11 PM
Unknown Object (File)
Dec 4 2024, 8:11 PM
Unknown Object (File)
Dec 4 2024, 7:49 PM
Unknown Object (File)
Nov 15 2024, 8:21 PM
Unknown Object (File)
Nov 15 2024, 8:21 PM
Unknown Object (File)
Nov 15 2024, 8:16 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.