pgsql: Convert some extern variables to static

Started by Peter Eisentrautalmost 2 years ago4 messagescomitters
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Convert some extern variables to static

These probably should have been static all along, it was only
forgotten out of sloppiness.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: /messages/by-id/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/720b0eaae9b8a8326b2b6a6ff88fca4f47c631d4

Modified Files
--------------
contrib/isn/EAN13.h | 4 +-
contrib/isn/ISBN.h | 8 +--
contrib/isn/ISMN.h | 4 +-
contrib/isn/ISSN.h | 4 +-
contrib/isn/UPC.h | 4 +-
src/backend/commands/user.c | 4 +-
src/backend/postmaster/launch_backend.c | 2 +-
src/backend/replication/logical/slotsync.c | 2 +-
src/backend/replication/logical/worker.c | 2 +-
src/backend/utils/misc/guc_tables.c | 7 ++-
src/bin/pg_archivecleanup/pg_archivecleanup.c | 15 ++---
src/bin/pg_basebackup/bbstreamer_file.c | 4 +-
src/bin/pg_basebackup/bbstreamer_gzip.c | 4 +-
src/bin/pg_basebackup/bbstreamer_inject.c | 2 +-
src/bin/pg_basebackup/bbstreamer_lz4.c | 4 +-
src/bin/pg_basebackup/bbstreamer_tar.c | 6 +-
src/bin/pg_basebackup/bbstreamer_zstd.c | 4 +-
src/bin/pg_basebackup/walmethods.c | 4 +-
src/bin/pg_checksums/pg_checksums.c | 4 +-
src/bin/pg_combinebackup/pg_combinebackup.c | 2 +-
src/bin/pg_rewind/pg_rewind.c | 12 ++--
src/bin/pg_test_timing/pg_test_timing.c | 2 +-
src/bin/pgbench/pgbench.c | 67 +++++++++++-----------
src/bin/scripts/vacuumdb.c | 2 +-
src/pl/plpgsql/src/pl_handler.c | 4 +-
src/test/isolation/isolation_main.c | 6 +-
src/test/modules/dummy_index_am/dummy_index_am.c | 6 +-
src/test/modules/libpq_pipeline/libpq_pipeline.c | 4 +-
.../test_json_parser_incremental.c | 2 +-
29 files changed, 99 insertions(+), 96 deletions(-)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: pgsql: Convert some extern variables to static

Peter Eisentraut <peter@eisentraut.org> writes:

Convert some extern variables to static

I'm surprised it took me so long to notice, but this commit
makes headerscheck unhappy:

$ src/tools/pginclude/headerscheck
In file included from /tmp/headerscheck.40tbNq/test.c:2:
./contrib/isn/EAN13.h:26:20: warning: 'EAN13_range' defined but not used [-Wunused-variable]
static const char *EAN13_range[][2] = {
^~~~~~~~~~~
In file included from /tmp/headerscheck.40tbNq/test.c:2:
./contrib/isn/ISBN.h:983:20: warning: 'ISBN_range_new' defined but not used [-Wunused-variable]
static const char *ISBN_range_new[][2] = {
^~~~~~~~~~~~~~
./contrib/isn/ISBN.h:50:20: warning: 'ISBN_range' defined but not used [-Wunused-variable]
static const char *ISBN_range[][2] = {
^~~~~~~~~~
In file included from /tmp/headerscheck.40tbNq/test.c:2:
./contrib/isn/ISMN.h:45:20: warning: 'ISMN_range' defined but not used [-Wunused-variable]
static const char *ISMN_range[][2] = {
^~~~~~~~~~
In file included from /tmp/headerscheck.40tbNq/test.c:2:
./contrib/isn/ISSN.h:46:20: warning: 'ISSN_range' defined but not used [-Wunused-variable]
static const char *ISSN_range[][2] = {
^~~~~~~~~~
In file included from /tmp/headerscheck.40tbNq/test.c:2:
./contrib/isn/UPC.h:26:20: warning: 'UPC_range' defined but not used [-Wunused-variable]
static const char *UPC_range[][2] = {
^~~~~~~~~

We could either revert the static-ification of these variables,
or move them into isn.c which seems to be the sole consumer.

regards, tom lane

#3Thomas Munro
thomas.munro@gmail.com
In reply to: Tom Lane (#2)
Re: pgsql: Convert some extern variables to static

On Fri, Sep 20, 2024 at 11:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Peter Eisentraut <peter@eisentraut.org> writes:

Convert some extern variables to static

I'm surprised it took me so long to notice, but this commit
makes headerscheck unhappy:

Also discussed at:

/messages/by-id/CA+hUKG+YVt5MBD-w0HyHpsGb4U8RNge3DvAbDmOFy_epGhZ2Mg@mail.gmail.com

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Thomas Munro (#3)
Re: pgsql: Convert some extern variables to static

On 20.09.24 01:48, Thomas Munro wrote:

On Fri, Sep 20, 2024 at 11:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Peter Eisentraut <peter@eisentraut.org> writes:

Convert some extern variables to static

I'm surprised it took me so long to notice, but this commit
makes headerscheck unhappy:

Also discussed at:

/messages/by-id/CA+hUKG+YVt5MBD-w0HyHpsGb4U8RNge3DvAbDmOFy_epGhZ2Mg@mail.gmail.com

I have committed the fix discussed there.