From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up PL/Perl's handling of the _() macro.
Date: Sun, 02 Jun 2019 16:23:46 +0000
Message-ID: <E1hXTGs-0001Qa-CP@gemulon.postgresql.org> (raw)
Clean up PL/Perl's handling of the _() macro.
Perl likes to redefine the _() macro:
#ifdef CAN_PROTOTYPE
#define _(args) args
#else ...
There was lots not to like about the way we dealt with this before:
1. Instead of taking care of the conflict centrally in plperl.h, we
expected every one of its ever-growing number of includers to do so.
This is duplicative and error-prone in itself, plus it means that
plperl.h fails to meet the expectation of being compilable standalone,
resulting in macro-redefinition warnings in cpluspluscheck.
2. We left _() with its Perl definition, meaning that if someone tried
to use it in any Perl-related extension, it would silently fail to
provide run-time translation. I don't see any live bugs of this ilk,
but it's clearly a hard-to-notice bug waiting to happen.
So fix that by centralizing the cleanup logic, making it match what
we're already doing for other macro conflicts with Perl. Since we only
expect plperl.h to be included by extensions not core code, we should
redefine _() as dgettext() not gettext().
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/032627ee7837f0baa539df7247e003dbaded2c90
Modified Files
--------------
contrib/hstore_plperl/hstore_plperl.c | 4 +---
contrib/jsonb_plperl/jsonb_plperl.c | 3 ---
src/pl/plperl/SPI.xs | 3 ---
src/pl/plperl/Util.xs | 4 +---
src/pl/plperl/plperl.c | 3 ---
src/pl/plperl/plperl.h | 15 +++++++++++++++
6 files changed, 17 insertions(+), 15 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Clean up PL/Perl's handling of the _() macro.
In-Reply-To: <E1hXTGs-0001Qa-CP@gemulon.postgresql.org>
References: <E1hXTGs-0001Qa-CP@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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