agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix -Wshadow=local warnings
Date: Tue, 08 Sep 2026 07:13:08 +0000
Message-ID: <E1x3q0x-00000003xFK-2bZl@gemulon.postgresql.org> (raw)

Fix -Wshadow=local warnings

This fixes issues with the same variable name being used in the same
function for two different variables.  (In some cases, one of the uses
is a function argument.)  The fix is in most cases to rename one or
both of them.  The individual choice depends on conventions in the
surrounding code.  Often, making both variable names more specific is
the best choice.  In a few cases, the fix is to move one of the
variables to a lower scope, so that it no longer conflicts with the
other.

Since these are all local-variable conflicts, the changes in different
files in this patch are independent of each other.

These issues correspond to the gcc warning option -Wshadow=local,
which is not currently used but could be activated after this.

Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/84b6f128-91f5-480e-8a9e-7d0e8f538cea%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f9fc9a78a36517122c0325fd31db5ba6066d82ea

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c                |  22 ++---
src/backend/access/brin/brin.c                     |   8 +-
src/backend/access/gist/gistbuild.c                |  16 ++--
src/backend/catalog/objectaddress.c                |  30 +++---
src/backend/catalog/pg_constraint.c                |  32 +++----
src/backend/commands/extension.c                   |   8 +-
src/backend/commands/schemacmds.c                  |   4 +-
src/backend/commands/statscmds.c                   |   6 +-
src/backend/commands/tablecmds.c                   |  14 +--
src/backend/commands/trigger.c                     |  12 +--
src/backend/executor/nodeAgg.c                     |  16 ++--
src/backend/executor/nodeValuesscan.c              |   4 +-
src/backend/optimizer/path/equivclass.c            |   6 +-
src/backend/optimizer/plan/createplan.c            |  44 ++++-----
src/backend/partitioning/partdesc.c                |  12 +--
src/backend/statistics/dependencies.c              |  30 +++---
src/backend/statistics/extended_stats.c            |   6 +-
src/backend/storage/aio/read_stream.c              |  14 +--
src/backend/storage/buffer/bufmgr.c                |  14 +--
src/backend/utils/adt/jsonpath_exec.c              |  48 +++++-----
src/backend/utils/adt/pg_upgrade_support.c         |   6 +-
src/backend/utils/adt/timestamp.c                  |  20 ++--
src/backend/utils/adt/varlena.c                    |  20 ++--
src/backend/utils/cache/inval.c                    |  48 +++++-----
src/backend/utils/mmgr/freepage.c                  |  42 ++++-----
src/bin/pg_basebackup/pg_receivewal.c              |   6 +-
src/bin/pgbench/pgbench.c                          |  62 ++++++------
src/bin/psql/describe.c                            |  18 ++--
src/bin/psql/prompt.c                              |  39 ++++----
src/bin/psql/prompt.h                              |   2 +-
src/fe_utils/print.c                               |  22 ++---
src/include/lib/radixtree.h                        |  16 ++--
src/include/optimizer/paths.h                      |   2 +-
src/include/storage/sinval.h                       |   4 +-
.../ecpg/test/expected/pgtypeslib-num_test2.c      |   3 +-
src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc  |   3 +-
src/interfaces/libpq/fe-connect.c                  |  12 ++-
src/interfaces/libpq/fe-secure-openssl.c           | 104 ++++++++++-----------
38 files changed, 393 insertions(+), 382 deletions(-)



Message-ID: <E1x3q0x-00000003xFK-2bZl@gemulon.postgresql.org>
Permalink:  ../E1x3q0x-00000003xFK-2bZl@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x3q0x-00000003xFK-2bZl@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix -Wshadow=local warnings
  In-Reply-To: <E1x3q0x-00000003xFK-2bZl@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox