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
Unknown Object (File)
Thu, Jan 9, 10:20 AM
Unknown Object (File)
Sun, Dec 15, 12:14 AM
Unknown Object (File)
Dec 10 2024, 8:50 PM
Unknown Object (File)
Nov 19 2024, 8:42 PM
Unknown Object (File)
Nov 16 2024, 9:27 AM
Unknown Object (File)
Nov 9 2024, 5:29 AM
Unknown Object (File)
Oct 19 2024, 3:24 AM
Unknown Object (File)
Sep 28 2024, 5:31 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