Re: Coding in WalSndWaitForWal - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Coding in WalSndWaitForWal
Date
Msg-id 20200109201911.GA24211@alvherre.pgsql
Whole thread Raw
In response to Re: Coding in WalSndWaitForWal  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Coding in WalSndWaitForWal  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2020-Jan-09, Tom Lane wrote:

> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > In modern times, we define pg_attribute_noreturn() like this:
> 
> > /* GCC, Sunpro and XLC support aligned, packed and noreturn */
> > #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
> > #define pg_attribute_noreturn() __attribute__((noreturn))
> > #define HAVE_PG_ATTRIBUTE_NORETURN 1
> > #else
> > #define pg_attribute_noreturn()
> > #endif
> 
> > I suppose this will cause warnings in compilers other than those, but
> > I'm not sure if we care.  What about MSVC for example?
> 
> Yeah, the lack of coverage for MSVC seems like the main reason not
> to assume this works "everywhere of interest".

That would easy to add as __declspec(noreturn) ... except that in MSVC
the decoration goes *before* the prototype rather after it, so this
seems difficult to achieve without invasive surgery.
https://docs.microsoft.com/en-us/cpp/cpp/noreturn?view=vs-2015

> > With the attached patch, everything compiles cleanly in my setup, no
> > warnings, but then it's GCC.
> 
> Meh ... I'm not really convinced that any of those changes are
> improvements.  Particularly not the removals of switch-case breaks.

However, we already have a large number of proc_exit() calls in switch
blocks that are not followed by breaks.  In fact, the majority are
already like that.

I can easily leave this well enough alone, though.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Removing pg_pltemplate and creating "trustable" extensions
Next
From: Tom Lane
Date:
Subject: Re: Removing pg_pltemplate and creating "trustable" extensions