1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

Change coding pattern for CURL_IGNORE_DEPRECATION()

Instead of having to write a semicolon inside the macro argument, we can
insert a semicolon with another macro layer.  This no longer gives
pg_bsd_indent indigestion, so we can remove the digestive aids that had
to be installed in the pgindent Perl script.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/202511111134.njrwf5w5nbjm@alvherre.pgsql
Backpatch-through: 18
This commit is contained in:
Álvaro Herrera
2025-11-12 12:35:14 +01:00
parent 040a39ed25
commit 78aae29830
2 changed files with 9 additions and 18 deletions

View File

@@ -1919,6 +1919,12 @@ start_request(struct async_ctx *actx)
#define CURL_IGNORE_DEPRECATION(x) x
#endif
/*
* Add another macro layer that inserts the needed semicolon, to avoid having
* to write a literal semicolon in the call below, which would break pgindent.
*/
#define PG_CURL_IGNORE_DEPRECATION(x) CURL_IGNORE_DEPRECATION(x;)
/*
* Drives the multi handle towards completion. The caller should have already
* set up an asynchronous request via start_request().
@@ -1948,11 +1954,10 @@ drive_request(struct async_ctx *actx)
* to remove or break this API, so ignore the deprecation. See
*
* https://curl.se/mail/lib-2024-11/0028.html
*
*/
CURL_IGNORE_DEPRECATION(
err = curl_multi_socket_all(actx->curlm, &actx->running);
)
PG_CURL_IGNORE_DEPRECATION(err =
curl_multi_socket_all(actx->curlm,
&actx->running));
if (err)
{

View File

@@ -245,14 +245,6 @@ sub pre_indent
# Protect wrapping in CATALOG()
$source =~ s!^(CATALOG\(.*)$!/*$1*/!gm;
# Treat a CURL_IGNORE_DEPRECATION() as braces for the purposes of
# indentation. (The recursive regex comes from the perlre documentation; it
# matches balanced parentheses as group $1 and the contents as group $2.)
my $curlopen = '{ /* CURL_IGNORE_DEPRECATION */';
my $curlclose = '} /* CURL_IGNORE_DEPRECATION */';
$source =~
s!^[ \t]+CURL_IGNORE_DEPRECATION(\(((?:(?>[^()]+)|(?1))*)\))!$curlopen$2$curlclose!gms;
return $source;
}
@@ -267,12 +259,6 @@ sub post_indent
$source =~ s!^/\* Open extern "C" \*/$!{!gm;
$source =~ s!^/\* Close extern "C" \*/$!}!gm;
# Restore the CURL_IGNORE_DEPRECATION() macro, keeping in mind that our
# markers may have been re-indented.
$source =~
s!{[ \t]+/\* CURL_IGNORE_DEPRECATION \*/!CURL_IGNORE_DEPRECATION(!gm;
$source =~ s!}[ \t]+/\* CURL_IGNORE_DEPRECATION \*/!)!gm;
## Comments
# Undo change of dash-protected block comments