Page MenuHomeFreeBSD

Add __diagused
ClosedPublic

Authored by mjg on Jul 14 2021, 11:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 8:37 AM
Unknown Object (File)
Sat, Mar 23, 12:09 AM
Unknown Object (File)
Mar 7 2024, 5:08 PM
Unknown Object (File)
Feb 14 2024, 4:40 AM
Unknown Object (File)
Dec 20 2023, 2:00 AM
Unknown Object (File)
Dec 11 2023, 1:14 AM
Unknown Object (File)
Nov 29 2023, 7:10 AM
Unknown Object (File)
Nov 29 2023, 2:04 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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.