pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Rely on __func__ being supported
4+ messages / 2 participants
[nested] [flat]

* pgsql: Rely on __func__ being supported
@ 2022-08-07 16:36 Andres Freund <andres@anarazel.de>
  2022-08-07 17:40 ` Re: pgsql: Rely on __func__ being supported Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Andres Freund @ 2022-08-07 16:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Rely on __func__ being supported

Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99
that shouldn't be necessary anymore.

Solution.pm defined HAVE_FUNCNAME__FUNCTION instead of
HAVE_FUNCNAME__FUNC (originating in 4164e6636e2), as at some point in the past
MSVC only supported __FUNCTION__. Our minimum version supports __func__.

Reviewed-By: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/320f92b744b44f961e5d56f5f21de003e8027a7f

Modified Files
--------------
config/c-compiler.m4              | 26 -----------------
configure                         | 61 ---------------------------------------
configure.ac                      |  1 -
src/backend/storage/lmgr/s_lock.c |  2 +-
src/include/c.h                   | 11 -------
src/include/pg_config.h.in        |  6 ----
src/include/storage/s_lock.h      |  4 +--
src/include/utils/elog.h          |  4 +--
src/tools/msvc/Solution.pm        |  2 --
9 files changed, 5 insertions(+), 112 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Rely on __func__ being supported
  2022-08-07 16:36 pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
@ 2022-08-07 17:40 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2022-08-07 17:45   ` Re: pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2022-08-07 17:40 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

On 2022-Aug-07, Andres Freund wrote:

> Rely on __func__ being supported
> 
> Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99
> that shouldn't be necessary anymore.
> 
> Solution.pm defined HAVE_FUNCNAME__FUNCTION instead of
> HAVE_FUNCNAME__FUNC (originating in 4164e6636e2), as at some point in the past
> MSVC only supported __FUNCTION__. Our minimum version supports __func__.

I'd rather we keep PG_FUNCNAME_MACRO defined to __func__ ... it costs us
nothing.  Would anybody oppose that?

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/

Attachments:

backw.patch (text/x-diff, 411B) download diff --git a/src/include/c.h b/src/include/c.h index de9ec04d49..d21cd71f0b 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -360,6 +360,8 @@ typedef void (*pg_funcptr_t) (void); */ #define FLEXIBLE_ARRAY_MEMBER /* empty */ +/* For backwards compatibility */ +#define PG_FUNCNAME_MACRO __func__ /* ---------------------------------------------------------------- * Section 2: bool, true, false
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: pgsql: Rely on __func__ being supported
  2022-08-07 16:36 pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
  2022-08-07 17:40 ` Re: pgsql: Rely on __func__ being supported Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2022-08-07 17:45   ` Andres Freund <andres@anarazel.de>
  2022-08-10 14:03     ` Re: pgsql: Rely on __func__ being supported Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Andres Freund @ 2022-08-07 17:45 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2022-08-07 19:40:14 +0200, Alvaro Herrera wrote:
> I'd rather we keep PG_FUNCNAME_MACRO defined to __func__ ... it costs us
> nothing.  Would anybody oppose that?

I'm fine with re-adding the macro, as long as we don't re-add in-tree users.

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Rely on __func__ being supported
  2022-08-07 16:36 pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
  2022-08-07 17:40 ` Re: pgsql: Rely on __func__ being supported Alvaro Herrera <alvherre@alvh.no-ip.org>
  2022-08-07 17:45   ` Re: pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
@ 2022-08-10 14:03     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Alvaro Herrera @ 2022-08-10 14:03 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

Hello

On 2022-Aug-07, Andres Freund wrote:

> On 2022-08-07 19:40:14 +0200, Alvaro Herrera wrote:
> > I'd rather we keep PG_FUNCNAME_MACRO defined to __func__ ... it costs us
> > nothing.  Would anybody oppose that?
> 
> I'm fine with re-adding the macro, as long as we don't re-add in-tree users.

After further thinking, I conclude there's no need for this.  It's quite
easy to add a "#ifndef PG_FUNCNAME_MACRO" stanza in third-party code if
needed, and just rely on __func__ otherwise.

Thanks

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-08-10 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 16:36 pgsql: Rely on __func__ being supported Andres Freund <andres@anarazel.de>
2022-08-07 17:40 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-08-07 17:45   ` Andres Freund <andres@anarazel.de>
2022-08-10 14:03     ` Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox