From c0133bb5b7573d0ec4d94b2f5f3d04e0261329ac Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 22 Jun 2024 10:27:40 +0200 Subject: [PATCH 5/5] Remove unused #include's from bin .c files as determined by IWYU --- src/bin/pg_basebackup/pg_createsubscriber.c | 3 +-- src/bin/pg_basebackup/pg_recvlogical.c | 2 -- src/bin/pg_basebackup/receivelog.c | 1 - src/bin/pg_basebackup/streamutil.c | 2 -- src/bin/pg_basebackup/walmethods.c | 4 ++-- src/bin/pg_checksums/pg_checksums.c | 1 - src/bin/pg_combinebackup/copy_file.h | 1 - src/bin/pg_combinebackup/pg_combinebackup.c | 2 +- src/bin/pg_config/pg_config.c | 1 - src/bin/pg_dump/common.c | 2 -- src/bin/pg_dump/compress_io.c | 1 - src/bin/pg_dump/filter.c | 1 - src/bin/pg_dump/parallel.c | 2 ++ src/bin/pg_dump/pg_backup_custom.c | 1 - src/bin/pg_dump/pg_backup_db.c | 2 -- src/bin/pg_dump/pg_backup_utils.c | 2 ++ src/bin/pg_dump/pg_dump.c | 2 -- src/bin/pg_dump/pg_dump_sort.c | 1 - src/bin/pg_dump/pg_restore.c | 1 - src/bin/pg_rewind/datapagemap.h | 1 - src/bin/pg_rewind/libpq_source.c | 1 - src/bin/pg_rewind/local_source.c | 4 +--- src/bin/pg_rewind/pg_rewind.h | 4 ---- src/bin/pg_test_fsync/pg_test_fsync.c | 1 - src/bin/pg_upgrade/check.c | 2 -- src/bin/pg_upgrade/relfilenumber.c | 2 -- src/bin/pg_walsummary/pg_walsummary.c | 1 - src/bin/psql/command.c | 3 --- src/bin/psql/describe.c | 1 - src/bin/psql/help.c | 3 --- src/bin/scripts/clusterdb.c | 1 - src/bin/scripts/common.c | 1 - src/bin/scripts/reindexdb.c | 1 - src/common/controldata_utils.c | 2 +- src/common/string.c | 1 - src/common/unicode_case.c | 1 - src/fe_utils/astreamer_file.c | 1 - src/fe_utils/astreamer_gzip.c | 2 -- src/fe_utils/astreamer_lz4.c | 2 -- src/fe_utils/cancel.c | 2 -- 40 files changed, 10 insertions(+), 59 deletions(-) diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index e804b2a63ef..e96370a9ec1 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -13,14 +13,13 @@ #include "postgres_fe.h" +#include #include #include #include -#include "catalog/pg_authid_d.h" #include "common/connect.h" #include "common/controldata_utils.h" -#include "common/file_perm.h" #include "common/logging.h" #include "common/pg_prng.h" #include "common/restricted_token.h" diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c index 3db520ed38b..42b2a7bb9d8 100644 --- a/src/bin/pg_basebackup/pg_recvlogical.c +++ b/src/bin/pg_basebackup/pg_recvlogical.c @@ -18,8 +18,6 @@ #include #include -#include "access/xlog_internal.h" -#include "common/fe_memutils.h" #include "common/file_perm.h" #include "common/logging.h" #include "fe_utils/option_utils.h" diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 70f42467649..9fe90cb38fd 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -19,7 +19,6 @@ #include #include "access/xlog_internal.h" -#include "common/file_utils.h" #include "common/logging.h" #include "libpq-fe.h" #include "receivelog.h" diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c index 30b3d9a377e..3f4d157d583 100644 --- a/src/bin/pg_basebackup/streamutil.c +++ b/src/bin/pg_basebackup/streamutil.c @@ -19,14 +19,12 @@ #include "access/xlog_internal.h" #include "common/connect.h" -#include "common/fe_memutils.h" #include "common/file_perm.h" #include "common/logging.h" #include "common/string.h" #include "datatype/timestamp.h" #include "port/pg_bswap.h" #include "pqexpbuffer.h" -#include "receivelog.h" #include "streamutil.h" #define ERRCODE_DUPLICATE_OBJECT "42710" diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index 832aafd2973..215b24597fe 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -11,6 +11,7 @@ #include "postgres_fe.h" +#include #include #include #include @@ -26,8 +27,7 @@ #include "common/file_utils.h" #include "common/logging.h" #include "pgtar.h" -#include "receivelog.h" -#include "streamutil.h" +#include "walmethods.h" /* Size of zlib buffer for .tar.gz */ #define ZLIB_OUT_SIZE 4096 diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c index f5f7ff10455..b86bc417c9c 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -21,7 +21,6 @@ #include #include "common/controldata_utils.h" -#include "common/file_perm.h" #include "common/file_utils.h" #include "common/logging.h" #include "common/relpath.h" diff --git a/src/bin/pg_combinebackup/copy_file.h b/src/bin/pg_combinebackup/copy_file.h index cedb7607385..d5ddc7e53d7 100644 --- a/src/bin/pg_combinebackup/copy_file.h +++ b/src/bin/pg_combinebackup/copy_file.h @@ -13,7 +13,6 @@ #include "c.h" #include "common/checksum_helper.h" -#include "common/file_utils.h" /* * Enumeration to denote copy modes. diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c index 6183d317151..5f1f62f1db6 100644 --- a/src/bin/pg_combinebackup/pg_combinebackup.c +++ b/src/bin/pg_combinebackup/pg_combinebackup.c @@ -25,12 +25,12 @@ #endif #include "backup_label.h" -#include "common/blkreftable.h" #include "common/checksum_helper.h" #include "common/controldata_utils.h" #include "common/file_perm.h" #include "common/file_utils.h" #include "common/logging.h" +#include "common/relpath.h" #include "copy_file.h" #include "fe_utils/option_utils.h" #include "getopt_long.h" diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c index 77d09ccfc47..504e6c58009 100644 --- a/src/bin/pg_config/pg_config.c +++ b/src/bin/pg_config/pg_config.c @@ -25,7 +25,6 @@ #include "postgres_fe.h" #include "common/config_info.h" -#include "port.h" static const char *progname; diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index c323b5bd3d9..9b2d34e2815 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -27,8 +27,6 @@ #include "catalog/pg_subscription_d.h" #include "catalog/pg_type_d.h" #include "common/hashfn.h" -#include "fe_utils/string_utils.h" -#include "pg_backup_archiver.h" #include "pg_backup_utils.h" #include "pg_dump.h" diff --git a/src/bin/pg_dump/compress_io.c b/src/bin/pg_dump/compress_io.c index e2edf8bf4f6..47a13099ccf 100644 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@ -70,7 +70,6 @@ #include "compress_lz4.h" #include "compress_none.h" #include "compress_zstd.h" -#include "pg_backup_utils.h" /*---------------------- * Generic functions diff --git a/src/bin/pg_dump/filter.c b/src/bin/pg_dump/filter.c index 5815cd23748..9dc6d22fcda 100644 --- a/src/bin/pg_dump/filter.c +++ b/src/bin/pg_dump/filter.c @@ -13,7 +13,6 @@ */ #include "postgres_fe.h" -#include "common/fe_memutils.h" #include "common/logging.h" #include "common/string.h" #include "filter.h" diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index a09247fae47..78e91f6e2dc 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -63,7 +63,9 @@ #include "fe_utils/string_utils.h" #include "parallel.h" #include "pg_backup_utils.h" +#ifdef WIN32 #include "port/pg_bswap.h" +#endif /* Mnemonic macros for indexing the fd array returned by pipe(2) */ #define PIPE_READ 0 diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 55107b20058..ecaad7321a3 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -27,7 +27,6 @@ #include "common/file_utils.h" #include "compress_io.h" -#include "parallel.h" #include "pg_backup_utils.h" /*-------- diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 4d1957a7eb3..71c55d2466a 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -19,8 +19,6 @@ #include "common/connect.h" #include "common/string.h" -#include "dumputils.h" -#include "fe_utils/string_utils.h" #include "parallel.h" #include "pg_backup_archiver.h" #include "pg_backup_db.h" diff --git a/src/bin/pg_dump/pg_backup_utils.c b/src/bin/pg_dump/pg_backup_utils.c index a0045cf5e58..80715979a1a 100644 --- a/src/bin/pg_dump/pg_backup_utils.c +++ b/src/bin/pg_dump/pg_backup_utils.c @@ -13,7 +13,9 @@ */ #include "postgres_fe.h" +#ifdef WIN32 #include "parallel.h" +#endif #include "pg_backup_utils.h" /* Globals exported by this file */ diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 1b47c388ced..ea759c5f78a 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -49,10 +49,8 @@ #include "catalog/pg_class_d.h" #include "catalog/pg_default_acl_d.h" #include "catalog/pg_largeobject_d.h" -#include "catalog/pg_largeobject_metadata_d.h" #include "catalog/pg_proc_d.h" #include "catalog/pg_subscription.h" -#include "catalog/pg_trigger_d.h" #include "catalog/pg_type_d.h" #include "common/connect.h" #include "common/int.h" diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index 4cb754caa55..d88ce06ff46 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -18,7 +18,6 @@ #include "catalog/pg_class_d.h" #include "common/int.h" #include "lib/binaryheap.h" -#include "pg_backup_archiver.h" #include "pg_backup_utils.h" #include "pg_dump.h" diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index df119591cca..f2c1020d053 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -45,7 +45,6 @@ #include #endif -#include "dumputils.h" #include "fe_utils/option_utils.h" #include "filter.h" #include "getopt_long.h" diff --git a/src/bin/pg_rewind/datapagemap.h b/src/bin/pg_rewind/datapagemap.h index 49124834508..be59ea23fc5 100644 --- a/src/bin/pg_rewind/datapagemap.h +++ b/src/bin/pg_rewind/datapagemap.h @@ -10,7 +10,6 @@ #define DATAPAGEMAP_H #include "storage/block.h" -#include "storage/relfilelocator.h" struct datapagemap { diff --git a/src/bin/pg_rewind/libpq_source.c b/src/bin/pg_rewind/libpq_source.c index 0239fb47644..62610a4efaf 100644 --- a/src/bin/pg_rewind/libpq_source.c +++ b/src/bin/pg_rewind/libpq_source.c @@ -11,7 +11,6 @@ #include "catalog/pg_type_d.h" #include "common/connect.h" -#include "datapagemap.h" #include "file_ops.h" #include "filemap.h" #include "lib/stringinfo.h" diff --git a/src/bin/pg_rewind/local_source.c b/src/bin/pg_rewind/local_source.c index 46c6b72bd71..4aab2ba0ac9 100644 --- a/src/bin/pg_rewind/local_source.c +++ b/src/bin/pg_rewind/local_source.c @@ -12,10 +12,8 @@ #include #include -#include "datapagemap.h" +#include "common/logging.h" #include "file_ops.h" -#include "filemap.h" -#include "pg_rewind.h" #include "rewind_source.h" typedef struct diff --git a/src/bin/pg_rewind/pg_rewind.h b/src/bin/pg_rewind/pg_rewind.h index ec43cbe2c67..d937542c6ec 100644 --- a/src/bin/pg_rewind/pg_rewind.h +++ b/src/bin/pg_rewind/pg_rewind.h @@ -14,10 +14,6 @@ #include "access/timeline.h" #include "common/logging.h" #include "common/file_utils.h" -#include "datapagemap.h" -#include "libpq-fe.h" -#include "storage/block.h" -#include "storage/relfilelocator.h" /* Configuration options */ extern char *datadir_target; diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c index cbf587116ea..65d05136f89 100644 --- a/src/bin/pg_test_fsync/pg_test_fsync.c +++ b/src/bin/pg_test_fsync/pg_test_fsync.c @@ -19,7 +19,6 @@ #include #include -#include "access/xlogdefs.h" #include "common/logging.h" #include "common/pg_prng.h" #include "getopt_long.h" diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 12735a42687..cba5031af87 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -11,9 +11,7 @@ #include "catalog/pg_authid_d.h" #include "catalog/pg_class_d.h" -#include "catalog/pg_collation.h" #include "fe_utils/string_utils.h" -#include "mb/pg_wchar.h" #include "pg_upgrade.h" static void check_new_cluster_is_empty(void); diff --git a/src/bin/pg_upgrade/relfilenumber.c b/src/bin/pg_upgrade/relfilenumber.c index 1d3054d78bd..07baa49a025 100644 --- a/src/bin/pg_upgrade/relfilenumber.c +++ b/src/bin/pg_upgrade/relfilenumber.c @@ -11,8 +11,6 @@ #include -#include "access/transam.h" -#include "catalog/pg_class_d.h" #include "pg_upgrade.h" static void transfer_single_new_db(FileNameMap *maps, int size, char *old_tablespace); diff --git a/src/bin/pg_walsummary/pg_walsummary.c b/src/bin/pg_walsummary/pg_walsummary.c index f6a262d3184..267174d07d0 100644 --- a/src/bin/pg_walsummary/pg_walsummary.c +++ b/src/bin/pg_walsummary/pg_walsummary.c @@ -20,7 +20,6 @@ #include "common/logging.h" #include "fe_utils/option_utils.h" #include "getopt_long.h" -#include "lib/stringinfo.h" typedef struct ws_options { diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 328d78c73f9..1f3cbb11f7c 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -30,7 +30,6 @@ #include "common/logging.h" #include "common/string.h" #include "copy.h" -#include "crosstabview.h" #include "describe.h" #include "fe_utils/cancel.h" #include "fe_utils/print.h" @@ -38,10 +37,8 @@ #include "help.h" #include "input.h" #include "large_obj.h" -#include "libpq-fe.h" #include "libpq/pqcomm.h" #include "mainloop.h" -#include "portability/instr_time.h" #include "pqexpbuffer.h" #include "psqlscanslash.h" #include "settings.h" diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 363a66e7185..37b43fb1221 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -27,7 +27,6 @@ #include "fe_utils/print.h" #include "fe_utils/string_utils.h" #include "settings.h" -#include "variables.h" static const char *map_typename_pattern(const char *pattern); static bool describeOneTableDetails(const char *schemaname, diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 19d20c58781..02fe5d151e0 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -21,9 +21,6 @@ #include #endif -#include "common.h" -#include "common/logging.h" -#include "common/username.h" #include "help.h" #include "input.h" #include "settings.h" diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index 3503a3bb584..7dd80d24137 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -16,7 +16,6 @@ #include "fe_utils/option_utils.h" #include "fe_utils/query_utils.h" #include "fe_utils/simple_list.h" -#include "fe_utils/string_utils.h" static void cluster_one_database(const ConnParams *cparams, const char *table, diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index d16381eda90..e3acd1e67a2 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -21,7 +21,6 @@ #include "common/connect.h" #include "common/logging.h" #include "common/string.h" -#include "fe_utils/cancel.h" #include "fe_utils/query_utils.h" #include "fe_utils/string_utils.h" diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index af0738d9334..659d8d5ba58 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -15,7 +15,6 @@ #include "catalog/pg_class_d.h" #include "common.h" -#include "common/connect.h" #include "common/logging.h" #include "fe_utils/cancel.h" #include "fe_utils/option_utils.h" diff --git a/src/common/controldata_utils.c b/src/common/controldata_utils.c index 82309b25107..52d4702ce87 100644 --- a/src/common/controldata_utils.c +++ b/src/common/controldata_utils.c @@ -28,8 +28,8 @@ #include "access/xlog_internal.h" #include "catalog/pg_control.h" #include "common/controldata_utils.h" -#include "common/file_perm.h" #ifdef FRONTEND +#include "common/file_perm.h" #include "common/logging.h" #endif #include "port/pg_crc32c.h" diff --git a/src/common/string.c b/src/common/string.c index ce9f2bc7ca5..4c42ae299b5 100644 --- a/src/common/string.c +++ b/src/common/string.c @@ -22,7 +22,6 @@ #endif #include "common/string.h" -#include "lib/stringinfo.h" /* diff --git a/src/common/unicode_case.c b/src/common/unicode_case.c index 291e256e639..542e7ea5378 100644 --- a/src/common/unicode_case.c +++ b/src/common/unicode_case.c @@ -17,7 +17,6 @@ #include "common/unicode_case.h" #include "common/unicode_case_table.h" -#include "common/unicode_category.h" #include "mb/pg_wchar.h" static const pg_case_map *find_case_map(pg_wchar ucs); diff --git a/src/fe_utils/astreamer_file.c b/src/fe_utils/astreamer_file.c index c9a030853bc..47568da2dbb 100644 --- a/src/fe_utils/astreamer_file.c +++ b/src/fe_utils/astreamer_file.c @@ -19,7 +19,6 @@ #include "common/file_perm.h" #include "common/logging.h" -#include "common/string.h" #include "fe_utils/astreamer.h" typedef struct astreamer_plain_writer diff --git a/src/fe_utils/astreamer_gzip.c b/src/fe_utils/astreamer_gzip.c index ca5be6423a1..e0b755317cb 100644 --- a/src/fe_utils/astreamer_gzip.c +++ b/src/fe_utils/astreamer_gzip.c @@ -32,9 +32,7 @@ #include #endif -#include "common/file_perm.h" #include "common/logging.h" -#include "common/string.h" #include "fe_utils/astreamer.h" #ifdef HAVE_LIBZ diff --git a/src/fe_utils/astreamer_lz4.c b/src/fe_utils/astreamer_lz4.c index 2bf14084e7f..a628088edfa 100644 --- a/src/fe_utils/astreamer_lz4.c +++ b/src/fe_utils/astreamer_lz4.c @@ -21,9 +21,7 @@ #include #endif -#include "common/file_perm.h" #include "common/logging.h" -#include "common/string.h" #include "fe_utils/astreamer.h" #ifdef USE_LZ4 diff --git a/src/fe_utils/cancel.c b/src/fe_utils/cancel.c index dcff9a85641..0df07fa4aa4 100644 --- a/src/fe_utils/cancel.c +++ b/src/fe_utils/cancel.c @@ -18,9 +18,7 @@ #include -#include "common/connect.h" #include "fe_utils/cancel.h" -#include "fe_utils/string_utils.h" /* -- 2.47.0