Re: Buffer locking is special (hints, checksums, AIO writes) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Buffer locking is special (hints, checksums, AIO writes)
Date
Msg-id ofzsidrczxdvxjtqxeb56qzfp6cw2sqkogds6phxkpnzssvtb5@jeibq7mlzgoy
Whole thread Raw
In response to Re: Buffer locking is special (hints, checksums, AIO writes)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2026-01-15 18:19:41 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Can't quite decide between just using always_inline - after all the buffer
> > locking really is a rather crucial code path - and just initializing
> > wait_event to 0. Either seems better than using a default:.
> 
> Yeah, I agree with not using a default: in case we ever extend
> the mode enum.  I'd be inclined to fix it like this:
> 
>              case BUFFER_LOCK_UNLOCK:
>                  pg_unreachable();
> +                /* silence possible compiler warning: */ 
> +                wait_event = 0;
>           }

Unfortunately that doesn't seem to do the trick, at least not locally (gcc
14). I think gcc is considering the case where mode has a value outside of the
known values of the enum.  Hence needing initialize wait_event to zero in the
declaration to avoid the warning.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Resetting recovery target parameters in pg_createsubscriber
Next
From: Chao Li
Date:
Subject: Re: Extended Statistics set/restore/clear functions.