HomeFreeBSD

Fix geom build with clang 17 and KTR enabled

Description

Fix geom build with clang 17 and KTR enabled

When building a kernel with clang 17 and KTR enabled, such as with the
LINT configurations, a -Werror warning is emitted:

sys/geom/geom_io.c:145:31: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
  145 |         if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~ ^
sys/geom/geom_io.c:145:31: note: use '&' for a bitwise operation
  145 |         if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
      |                                      ^~
      |                                      &
sys/geom/geom_io.c:145:31: note: remove constant to silence this warning

Replace the multiple uses of the expression with one macro, and in this
macro use "!= 0" to get a logical operand instead of a bitwise one.

Reviewed by: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41823

Details

Provenance
dimAuthored on Sep 12 2023, 6:52 AM
Reviewer
jhb
Differential Revision
D41823: Fix geom build with clang 17 and KTR enabled
Parents
rGf7c733e4fe5d: amd64: Convert a cheap DIAGNOSTIC check to a KASSERT
Branches
Unknown
Tags
Unknown