Re: Is abort() still needed in WalSndShutdown()? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Is abort() still needed in WalSndShutdown()?
Date
Msg-id 796c4d50-b92b-46a7-8c07-60acb3a9b75d@iki.fi
Whole thread Raw
In response to Is abort() still needed in WalSndShutdown()?  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: Is abort() still needed in WalSndShutdown()?
List pgsql-hackers
On 23/01/2026 14:13, Fujii Masao wrote:
> Hi,
> 
> While reviewing the patch [1], I found that WalSndShutdown() calls abort()
> with the comment "keep the compiler quiet" just after proc_exit(0).
> 
>          static void
>          WalSndShutdown(void)
>          {
>          /*
>          * Reset whereToSendOutput to prevent ereport from attempting to send any
>          * more messages to the standby.
>          */
>          if (whereToSendOutput == DestRemote)
>          whereToSendOutput = DestNone;
> 
>          proc_exit(0);
>          abort(); /* keep the compiler quiet */
>          }
> 
> This may have been necessary in the past, but is it still required?
> Other functions, such as CheckpointerMain(), simply call proc_exit(0)
> without an abort(), which doesn't seem to cause compiler warnings.
> That made me wonder whether the abort() in WalSndShutdown() is
> still needed, or which compiler would actually warn if WalSndLoop()
> does not end with an abort().

Seems useless to me. Looking at the git history, long time ago the 
proc_exit(0) call was in a function that returned "int", and I can see 
how the compiler would complain about that if it didn't know that the 
function doesn't return. But WalSendShutdown() returns void these days, 
so you should not get a compiler warning, whether or not the compiler 
understands that proc_exit(0) doesn't return.

- Heikki




pgsql-hackers by date:

Previous
From: Amul Sul
Date:
Subject: Re: pg_waldump: support decoding of WAL inside tarfile
Next
From: vignesh C
Date:
Subject: Re: Skipping schema changes in publication