pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add optional parameter to PG_TRY() macros
Date: Wed, 05 Oct 2022 21:09:46 +0000
Message-ID: <E1ogBeD-0013zi-IN@gemulon.postgresql.org> (raw)

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(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1ogBeD-0013zi-IN@gemulon.postgresql.org>
Permalink:  ../E1ogBeD-0013zi-IN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ogBeD-0013zi-IN@gemulon.postgresql.org

 · 

reply

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: drowley@postgresql.org
  Subject: Re: pgsql: Add optional parameter to PG_TRY() macros
  In-Reply-To: <E1ogBeD-0013zi-IN@gemulon.postgresql.org>
  References: <E1ogBeD-0013zi-IN@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