pgsql: Add optional parameter to PG_TRY() macros

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add optional parameter to PG_TRY() macros
Date: 2022-10-05 21:09:46
Message-ID: E1ogBeD-0013zi-IN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add optional parameter to PG_TRY() macros

This optional parameter can be specified in cases where there are nested
PG_TRY() statements within a function in order to stop the compiler from
issuing warnings about shadowed local variables when compiling with
-Wshadow. The optional parameter is used as a suffix on the variable
names declared within the PG_TRY(), PG_CATCH(), PG_FINALLY() and
PG_END_TRY() macros. The parameter, if specified, must be the same in
each component macro of the given PG_TRY() block.

This also adjusts the single case where we have nested PG_TRY() statements
to add a parameter to the inner-most PG_TRY().

This reduces the number of compiler warnings when compiling with
-Wshadow=compatible-local from 5 down to 1.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvqWGMdB_pATeUqE=JCtNqNxObPOJ00jFEa2_sZ20j_Wvg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/112f0225dbfe8af217294bfa0bd227f3302a1658

Modified Files
--------------
src/backend/tcop/utility.c | 6 +++---
src/include/utils/elog.h | 44 ++++++++++++++++++++++++++------------------
2 files changed, 29 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2022-10-05 21:20:26 pgsql: Fix final compiler warning produced by -Wshadow=compatible-local
Previous Message Bruce Momjian 2022-10-05 20:17:57 pgsql: relnotes: fix author names