From 60806ea8dd8fc9a6878cfc8b7f710e470b7a3d67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Tue, 11 Nov 2025 12:32:46 +0100
Subject: [PATCH] Try to do the CURL_IGNORE_DEPRECATION() thing in a less
 horrible way

---
 src/interfaces/libpq-oauth/oauth-curl.c |  8 +++++---
 src/tools/pgindent/pgindent             | 14 --------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/src/interfaces/libpq-oauth/oauth-curl.c b/src/interfaces/libpq-oauth/oauth-curl.c
index aa50b00d053..4a1e8dc1d89 100644
--- a/src/interfaces/libpq-oauth/oauth-curl.c
+++ b/src/interfaces/libpq-oauth/oauth-curl.c
@@ -1919,6 +1919,8 @@ start_request(struct async_ctx *actx)
 #define CURL_IGNORE_DEPRECATION(x) x
 #endif
 
+#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().
@@ -1950,9 +1952,9 @@ drive_request(struct async_ctx *actx)
 		 *    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)
 		{
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index b7d71808924..d14da3f01a9 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -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
-- 
2.47.3

