Page MenuHomeFreeBSD

msk: Use a void cast to mark values of dummy reads as unused.
ClosedPublic

Authored by jhb on Sep 28 2022, 9:14 PM.
Tags
None
Referenced Files
F86063389: D36777.id111157.diff
Fri, Jun 14, 8:50 PM
Unknown Object (File)
May 10 2024, 4:46 AM
Unknown Object (File)
Feb 14 2024, 6:02 AM
Unknown Object (File)
Dec 20 2023, 7:03 AM
Unknown Object (File)
Nov 18 2023, 4:26 PM
Unknown Object (File)
Nov 7 2023, 6:49 PM
Unknown Object (File)
Nov 7 2023, 1:20 AM
Unknown Object (File)
Nov 5 2023, 7:41 PM
Subscribers
None

Details

Summary

Note that this required adding missing ()'s around the outermost level
of MSK_READ_MIB*. Otherwise, the void cast was only applied to the
first register read. This also meant that MSK_READ_MIB64 was pretty
broken as the uint64_t cast only applied to the first 16-bit register
read in each MSK_READ_MIB32 invocation and the 32-bit shift was only
applied to the second register read of the pair.

Reported by: GCC -Wunused-value

Diff Detail

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

Event Timeline

jhb requested review of this revision.Sep 28 2022, 9:14 PM
jhb created this revision.
This revision is now accepted and ready to land.Sep 29 2022, 12:38 AM

though not sure the value of the void casts...

(void) casts is what I used to quiet -Wunused-but-set-variable warnings in clang for cases like this where we want to force a register read without using the result. OTOH, reading the "spare" registers in msk_stats_update might be dubious and we'd be better off removing those perhaps?

jhb retitled this revision from msk: Use void casts to mark values of dummy reads as unused. to msk: Use a void cast to mark values of dummy reads as unused..Oct 3 2022, 11:20 PM
  • Removed reading unused spare registers in a separate commit.
This revision now requires review to proceed.Oct 3 2022, 11:22 PM

Sounds good (both the explanation and the splitting up of the commit)

This revision is now accepted and ready to land.Oct 4 2022, 6:12 PM