On Wed, Jan 15, 2025 at 12:19:03PM -0500, Tom Lane wrote: > I don't see a reasonable way to alter that check to suppress this; > for instance, "(io_op) <= IOOP_WRITE" would probably still draw the > same warning. I think most likely we have to remove that check, ie > > #define pgstat_is_ioop_tracked_in_bytes(io_op) \ > - ((io_op) < IOOP_NUM_TYPES && (io_op) >= IOOP_EXTEND) > + ((io_op) >= IOOP_EXTEND) > > I suppose one alternative is to re-order the enum so that the > upper-limit check in this macro *isn't* tautological ... but > that seems a bit silly.
I cannot reproduce that, perhaps I'm just missing something with these switches. Do you think that a cast would cool things? Please see the attached for the idea. -- Michael
diff --git a/src/backend/utils/activity/pgstat_io.c b/src/backend/utils/activity/pgstat_io.c index e03b021af3..0cf5fcf564 100644 --- a/src/backend/utils/activity/pgstat_io.c +++ b/src/backend/utils/activity/pgstat_io.c @@ -29,7 +29,8 @@ static bool have_iostats = false; * elements. */ #define pgstat_is_ioop_tracked_in_bytes(io_op) \ - ((io_op) < IOOP_NUM_TYPES && (io_op) >= IOOP_EXTEND) + (((unsigned int) io_op) < IOOP_NUM_TYPES && \ + ((unsigned int) io_op) >= IOOP_EXTEND) /* * Check that stats have not been counted for any combination of IOObject,
signature.asc
Description: PGP signature