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
F97318172: D36777.diff
Sat, Sep 28, 3:30 PM
F97247077: D36777.id111491.diff
Sat, Sep 28, 7:59 AM
Unknown Object (File)
Fri, Sep 27, 7:26 AM
Unknown Object (File)
Fri, Sep 27, 7:26 AM
Unknown Object (File)
Fri, Sep 27, 7:26 AM
Unknown Object (File)
Wed, Sep 25, 12:21 AM
Unknown Object (File)
Tue, Sep 24, 7:42 AM
Unknown Object (File)
Tue, Sep 24, 12:40 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 47589
Build 44476: arc lint + arc unit

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