Re: pgsql: aio: Add core asynchronous I/O infrastructure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: aio: Add core asynchronous I/O infrastructure
Date: 2025-03-18 15:03:36
Message-ID: 93029.1742310216@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Andres Freund <andres(at)anarazel(dot)de> writes:
> aio: Add core asynchronous I/O infrastructure

Some of the buildfarm is mildly unhappy with this.
So far I see

ayu | 2025-03-18 13:08:04 | aio_callback.c:83:12: warning: comparison of constant 1 with expression of type 'PgAioHandleCallbackID' (aka 'enum PgAioHandleCallbackID') is always false [-Wtautological-constant-out-of-range-compare]
ayu | 2025-03-18 13:08:04 | aio_callback.c:190:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
ayu | 2025-03-18 13:08:04 | aio_callback.c:220:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
ayu | 2025-03-18 13:08:04 | aio_callback.c:274:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
ayu | 2025-03-18 13:08:04 | aio_target.c:50:41: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
ayu | 2025-03-18 13:08:04 | aio_target.c:110:41: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_callback.c:83:12: warning: comparison of constant 1 with expression of type 'PgAioHandleCallbackID' (aka 'enum PgAioHandleCallbackID') is always false [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_callback.c:190:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_callback.c:220:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_callback.c:274:56: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_target.c:50:41: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]
demoiselle | 2025-03-18 03:43:46 | aio_target.c:110:41: warning: comparison of constant 1 with expression of type 'PgAioTargetID' (aka 'enum PgAioTargetID') is always true [-Wtautological-constant-out-of-range-compare]

I don't have that compiler handy to check, but maybe changes like

- if (cb_id >= lengthof(aio_handle_cbs))
+ if ((size_t) cb_id >= lengthof(aio_handle_cbs))

would silence these? Or you could just drop all those tests
and have faith in the type-safety of the enums.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-03-18 15:14:12 Re: pgsql: aio: Add core asynchronous I/O infrastructure
Previous Message Tom Lane 2025-03-18 14:54:23 pgsql: Silence compiler warning.