Similar to __diagused (D31185) this macro is for variables which are
only used in SMP configurations. This should ease the burdon of
handling variables which are unused in non-SMP configurations.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 43826 Build 40714: arc lint + arc unit
Event Timeline
How many applications of this do you (plan to) have? If it ubiquitous situation, then yes, adding specific marker is useful. But I doubt it, I suspect there would be just several cases when it is useful, literally a dozen at best.
For similar cases, where kernel was compiled with one-off option, I believe I put __unused directly.
I believe it is mostly an issue of how often non-SMP builds are done. I've already observed several places in a single file where having this would distinctly reduce the need for #ifdef SMP to avoid write-only variable warnings if those were enabled (kind of looks like something of an audit job is being done, there a plan to enable warnings/errors?). I suspect this isn't the only case, but I cannot state with certainty this whether this would be a major gain.
The real case for this is variables which are set in multiple places in a function, but only used once near the end. To much such compile cleanly, the variable declaration and every point where it is set would need #ifdef SMP. While with this the variable could be marked __smpused and only the use at the end would need #ifdef SMP.
I don't have a count of how often this might get used, but I suspect there are many.
Wasn't an issue of fixing many places, but there are plenty of places where it would be handier to use __smpused instead of wrapping variables in #ifdef SMP/#endif. One such is sys/dev/xen/bus/xen_intr.c the function xen_intr_rebind_isrc() where cpu and error are unused for non-SMP.
Though non-SMP is likely the next hardware feature to lose support. This seemed potentially better in places, but at this point...