Thread: pgsql: Convert some extern variables to static

pgsql: Convert some extern variables to static

From
Peter Eisentraut
Date:
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: https://www.postgresql.org/message-id/flat/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(-)


Re: pgsql: Convert some extern variables to static

From
Tom Lane
Date:
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



Re: pgsql: Convert some extern variables to static

From
Thomas Munro
Date:
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:


https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BYVt5MBD-w0HyHpsGb4U8RNge3DvAbDmOFy_epGhZ2Mg%40mail.gmail.com#aba3226c6dd493923bd6ce95d25a2d77



Re: pgsql: Convert some extern variables to static

From
Peter Eisentraut
Date:
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:
> 
>
https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BYVt5MBD-w0HyHpsGb4U8RNge3DvAbDmOFy_epGhZ2Mg%40mail.gmail.com#aba3226c6dd493923bd6ce95d25a2d77

I have committed the fix discussed there.