pgsql: Rely on __func__ being supported

Started by Andres Freundalmost 4 years ago4 messagescomitters
Jump to latest
#1Andres Freund
andres@anarazel.de

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: /messages/by-id/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(-)

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andres Freund (#1)
Re: pgsql: Rely on __func__ being supported

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.patchtext/x-diff; charset=us-asciiDownload+2-0
#3Andres Freund
andres@anarazel.de
In reply to: Alvaro Herrera (#2)
Re: pgsql: Rely on __func__ being supported

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

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andres Freund (#3)
Re: pgsql: Rely on __func__ being supported

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/