CURL_IGNORE_DEPRECATION

Started by Alvaro Herrera5 months ago6 messageshackers
Jump to latest
#1Alvaro Herrera
alvherre@2ndquadrant.com

Hackers,

I just noticed that we have some ad-hoc hacks for the
CURL_IGNORE_DEPRECATION macro in the pgindent Perl script, which I find
a bit uncomfortable. Given that we use that macro in a single place,
what do you think about removing that and making a more surgical
intervention to fix pgindent problem with it? I propose the attached.

For context: in curl, that macro is defined like this

#define CURL_IGNORE_DEPRECATION(statements) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
statements \
_Pragma("GCC diagnostic pop")

(with #ifdef guards and whatnot). Because it has a _Pragma after the
statements argument, any uses of this macro must have a terminating
semicolon, which pgindent does not like. (It's also IMO rather
C-unlike). So my approach here is to add another macro to insert that
semicolon where it's needed. Of course, there's nothing we can do with
CURL_IGNORE_DEPRECATION() itself, given that it's upstream from us.

Thoughts?

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
“Cuando no hay humildad las personas se degradan” (A. Christie)

Attachments:

0001-Try-to-do-the-CURL_IGNORE_DEPRECATION-thing-in-a-les.patchtext/x-diff; charset=utf-8Download+5-18
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#1)
Re: CURL_IGNORE_DEPRECATION

On 2025-11-11 Tu 6:41 AM, Álvaro Herrera wrote:

Hackers,

I just noticed that we have some ad-hoc hacks for the
CURL_IGNORE_DEPRECATION macro in the pgindent Perl script, which I find
a bit uncomfortable. Given that we use that macro in a single place,
what do you think about removing that and making a more surgical
intervention to fix pgindent problem with it? I propose the attached.

For context: in curl, that macro is defined like this

#define CURL_IGNORE_DEPRECATION(statements) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
statements \
_Pragma("GCC diagnostic pop")

(with #ifdef guards and whatnot). Because it has a _Pragma after the
statements argument, any uses of this macro must have a terminating
semicolon, which pgindent does not like. (It's also IMO rather
C-unlike). So my approach here is to add another macro to insert that
semicolon where it's needed. Of course, there's nothing we can do with
CURL_IGNORE_DEPRECATION() itself, given that it's upstream from us.

Thoughts?

Looks reasonable. The regex in pgindent is fairly impenetrable, so
getting rid of it would be nice.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Alvaro Herrera (#1)
Re: CURL_IGNORE_DEPRECATION

On 11 Nov 2025, at 12:41, Álvaro Herrera <alvherre@kurilemu.de> wrote:

Given that we use that macro in a single place,
what do you think about removing that and making a more surgical
intervention to fix pgindent problem with it? I propose the attached.

This proposal is a better solution than what was committed, +1.

Of course, there's nothing we can do with
CURL_IGNORE_DEPRECATION() itself, given that it's upstream from us.

Yup, sorry about that.

--
Daniel Gustafsson

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Gustafsson (#3)
Re: CURL_IGNORE_DEPRECATION

Daniel Gustafsson <daniel@yesql.se> writes:

On 11 Nov 2025, at 12:41, Álvaro Herrera <alvherre@kurilemu.de> wrote:
Given that we use that macro in a single place,
what do you think about removing that and making a more surgical
intervention to fix pgindent problem with it? I propose the attached.

This proposal is a better solution than what was committed, +1.

+1

regards, tom lane

#5Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#4)
Re: CURL_IGNORE_DEPRECATION

On 2025-Nov-11, Tom Lane wrote:

Daniel Gustafsson <daniel@yesql.se> writes:

This proposal is a better solution than what was committed, +1.

+1

Thanks all for looking -- pushed.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

#6Jacob Champion
jacob.champion@enterprisedb.com
In reply to: Alvaro Herrera (#5)
Re: CURL_IGNORE_DEPRECATION

On Wed, Nov 12, 2025 at 3:36 AM Álvaro Herrera <alvherre@kurilemu.de> wrote:

Thanks all for looking -- pushed.

Slightly late to the party, but thanks! This is much nicer.

--Jacob