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.
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.