mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
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
This commit is contained in:
parent
f7c733e4fe
commit
479d224efc
|
@ -68,6 +68,9 @@
|
|||
#include <vm/vm_extern.h>
|
||||
#include <vm/vm_map.h>
|
||||
|
||||
#define KTR_GEOM_ENABLED \
|
||||
((KTR_COMPILE & KTR_GEOM) != 0 && (ktr_mask & KTR_GEOM) != 0)
|
||||
|
||||
static int g_io_transient_map_bio(struct bio *bp);
|
||||
|
||||
static struct g_bioq g_bio_run_down;
|
||||
|
@ -142,7 +145,7 @@ g_new_bio(void)
|
|||
|
||||
bp = uma_zalloc(biozone, M_NOWAIT | M_ZERO);
|
||||
#ifdef KTR
|
||||
if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
|
||||
if (KTR_GEOM_ENABLED) {
|
||||
struct stack st;
|
||||
|
||||
CTR1(KTR_GEOM, "g_new_bio(): %p", bp);
|
||||
|
@ -160,7 +163,7 @@ g_alloc_bio(void)
|
|||
|
||||
bp = uma_zalloc(biozone, M_WAITOK | M_ZERO);
|
||||
#ifdef KTR
|
||||
if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
|
||||
if (KTR_GEOM_ENABLED) {
|
||||
struct stack st;
|
||||
|
||||
CTR1(KTR_GEOM, "g_alloc_bio(): %p", bp);
|
||||
|
@ -175,7 +178,7 @@ void
|
|||
g_destroy_bio(struct bio *bp)
|
||||
{
|
||||
#ifdef KTR
|
||||
if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
|
||||
if (KTR_GEOM_ENABLED) {
|
||||
struct stack st;
|
||||
|
||||
CTR1(KTR_GEOM, "g_destroy_bio(): %p", bp);
|
||||
|
@ -220,7 +223,7 @@ g_clone_bio(struct bio *bp)
|
|||
bp->bio_children++;
|
||||
}
|
||||
#ifdef KTR
|
||||
if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
|
||||
if (KTR_GEOM_ENABLED) {
|
||||
struct stack st;
|
||||
|
||||
CTR2(KTR_GEOM, "g_clone_bio(%p): %p", bp, bp2);
|
||||
|
@ -249,7 +252,7 @@ g_duplicate_bio(struct bio *bp)
|
|||
bp2->bio_attribute = bp->bio_attribute;
|
||||
bp->bio_children++;
|
||||
#ifdef KTR
|
||||
if ((KTR_COMPILE & KTR_GEOM) && (ktr_mask & KTR_GEOM)) {
|
||||
if (KTR_GEOM_ENABLED) {
|
||||
struct stack st;
|
||||
|
||||
CTR2(KTR_GEOM, "g_duplicate_bio(%p): %p", bp, bp2);
|
||||
|
|
Loading…
Reference in a new issue