From 9e3755ecb2d058f7d123dd35a2e1784006190962 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 25 Feb 2017 16:12:24 -0500 Subject: [PATCH] Remove useless duplicate inclusions of system header files. c.h #includes a number of core libc header files, such as . There's no point in re-including these after having read postgres.h, postgres_fe.h, or c.h; so remove code that did so. While at it, also fix some places that were ignoring our standard pattern of "include postgres[_fe].h, then system header files, then other Postgres header files". While there's not any great magic in doing it that way rather than system headers last, it's silly to have just a few files deviating from the general pattern. (But I didn't attempt to enforce this globally, only in files I was touching anyway.) I'd be the first to say that this is mostly compulsive neatnik-ism, but over time it might save enough compile cycles to be useful. --- contrib/fuzzystrmatch/dmetaphone.c | 12 +++++++----- contrib/ltree/crc32.c | 4 ---- contrib/pgcrypto/px.h | 1 - src/backend/access/transam/timeline.c | 1 - src/backend/access/transam/twophase.c | 1 - src/backend/access/transam/xlogarchive.c | 1 - src/backend/commands/dbcommands.c | 1 - src/backend/commands/tablespace.c | 1 - src/backend/libpq/ifaddr.c | 1 - src/backend/port/atomics.c | 1 - src/backend/port/dynloader/freebsd.h | 1 - src/backend/port/dynloader/netbsd.h | 1 - src/backend/port/dynloader/openbsd.h | 1 - src/backend/port/win32/crashdump.c | 3 +-- src/backend/postmaster/autovacuum.c | 1 - src/backend/replication/basebackup.c | 1 - src/backend/replication/logical/snapbuild.c | 1 - src/backend/replication/walreceiverfuncs.c | 1 - src/backend/storage/ipc/dsm.c | 1 - src/backend/storage/ipc/dsm_impl.c | 1 - src/backend/storage/ipc/latch.c | 1 - src/backend/utils/adt/cash.c | 1 - src/backend/utils/adt/dbsize.c | 1 - src/backend/utils/adt/inet_cidr_ntop.c | 1 - src/backend/utils/adt/inet_net_pton.c | 1 - src/backend/utils/adt/pg_locale.c | 1 - src/backend/utils/init/miscinit.c | 1 - src/bin/initdb/initdb.c | 1 - src/bin/pg_basebackup/pg_basebackup.c | 1 - src/bin/pg_basebackup/pg_receivewal.c | 1 - src/bin/pg_basebackup/streamutil.c | 3 --- src/bin/pg_ctl/pg_ctl.c | 11 ++++------- src/bin/pg_dump/parallel.c | 14 ++++++-------- src/bin/pg_dump/pg_backup_archiver.c | 16 +++++++--------- src/bin/pg_dump/pg_dump.c | 3 --- src/bin/pg_dump/pg_dumpall.c | 4 ---- src/bin/pg_dump/pg_restore.c | 15 +++++---------- src/bin/pg_resetwal/pg_resetwal.c | 1 - src/bin/pg_rewind/copy_fetch.c | 2 -- src/bin/pg_rewind/fetch.c | 1 - src/bin/pg_rewind/file_ops.c | 1 - src/bin/pg_rewind/filemap.c | 1 - src/bin/pg_rewind/libpq_fetch.c | 1 - src/bin/pg_upgrade/dump.c | 1 - src/bin/pg_upgrade/exec.c | 5 ++--- src/bin/pg_upgrade/option.c | 11 +++++------ src/bin/pg_upgrade/parallel.c | 9 +++------ src/bin/pg_upgrade/tablespace.c | 2 -- src/bin/pgevent/pgevent.c | 6 ------ src/bin/psql/command.c | 2 -- src/bin/psql/crosstabview.c | 2 -- src/bin/psql/help.c | 1 - src/bin/psql/startup.c | 4 ---- src/common/ip.c | 1 - src/common/username.c | 2 -- src/common/wait_error.c | 2 -- src/fe_utils/print.c | 1 - src/include/libpq/libpq.h | 1 - src/include/port/atomics/generic-msvc.h | 1 - src/include/utils/pg_locale.h | 1 - src/interfaces/ecpg/ecpglib/data.c | 2 -- src/interfaces/ecpg/ecpglib/execute.c | 1 - src/interfaces/ecpg/ecpglib/typename.c | 1 - src/interfaces/ecpg/preproc/ecpg.c | 2 +- src/interfaces/ecpg/preproc/pgc.l | 1 - src/interfaces/libpq/fe-connect.c | 1 - src/interfaces/libpq/libpq-int.h | 1 - src/interfaces/libpq/pthread-win32.c | 1 - src/pl/plperl/plperl.c | 1 - src/port/chklocale.c | 5 ----- src/port/dirmod.c | 1 - src/port/inet_net_ntop.c | 1 - src/port/open.c | 1 - src/port/system.c | 1 - src/test/isolation/isolationtester.c | 3 --- src/timezone/strftime.c | 1 - src/timezone/zic.c | 1 - 77 files changed, 41 insertions(+), 155 deletions(-) diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c index 147c8501ee..f210869acb 100644 --- a/contrib/fuzzystrmatch/dmetaphone.c +++ b/contrib/fuzzystrmatch/dmetaphone.c @@ -93,9 +93,6 @@ The remaining code is authored by Andrew Dunstan and ***********************************************************************/ - - - /* include these first, according to the docs */ #ifndef DMETAPHONE_MAIN @@ -105,14 +102,19 @@ The remaining code is authored by Andrew Dunstan and /* turn off assertions for embedded function */ #define NDEBUG -#endif +#else /* DMETAPHONE_MAIN */ + +/* we need these if we didn't get them from postgres.h */ #include -#include #include #include #include + +#endif /* DMETAPHONE_MAIN */ + #include +#include /* prototype for the main function we got from the perl module */ static void DoubleMetaphone(char *, char **); diff --git a/contrib/ltree/crc32.c b/contrib/ltree/crc32.c index 403dae0d7d..447e4b2960 100644 --- a/contrib/ltree/crc32.c +++ b/contrib/ltree/crc32.c @@ -9,10 +9,6 @@ #include "postgres.h" -#include -#include -#include - #ifdef LOWER_NODE #include #define TOLOWER(x) tolower((unsigned char) (x)) diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h index 00fc6f0c01..e68a95a058 100644 --- a/contrib/pgcrypto/px.h +++ b/contrib/pgcrypto/px.h @@ -32,7 +32,6 @@ #ifndef __PX_H #define __PX_H -#include #include /* keep debug messages? */ diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index c8240b112d..1fdc59190c 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -32,7 +32,6 @@ #include "postgres.h" #include -#include #include #include "access/timeline.h" diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 50c70b2920..0a8edb9e58 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -54,7 +54,6 @@ #include #include -#include #include #include diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c index 7e91e8f81a..7afb73579b 100644 --- a/src/backend/access/transam/xlogarchive.c +++ b/src/backend/access/transam/xlogarchive.c @@ -14,7 +14,6 @@ #include "postgres.h" -#include #include #include #include diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 1ebacbc24f..5a63b1abcb 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -20,7 +20,6 @@ #include "postgres.h" #include -#include #include #include diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 80515bae19..f9c26201d9 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -48,7 +48,6 @@ #include #include -#include #include #include "access/heapam.h" diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c index 7692881c8b..f81003f7c8 100644 --- a/src/backend/libpq/ifaddr.c +++ b/src/backend/libpq/ifaddr.c @@ -20,7 +20,6 @@ #include "postgres.h" #include -#include #include #include #include diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c index 86b5308214..756a2ef997 100644 --- a/src/backend/port/atomics.c +++ b/src/backend/port/atomics.c @@ -21,7 +21,6 @@ #ifdef WIN32 #error "barriers are required (and provided) on WIN32 platforms" #endif -#include #include #endif diff --git a/src/backend/port/dynloader/freebsd.h b/src/backend/port/dynloader/freebsd.h index 78dda69922..6116d3f83f 100644 --- a/src/backend/port/dynloader/freebsd.h +++ b/src/backend/port/dynloader/freebsd.h @@ -13,7 +13,6 @@ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H -#include #include #include #include diff --git a/src/backend/port/dynloader/netbsd.h b/src/backend/port/dynloader/netbsd.h index 688b7fb793..0bd406850d 100644 --- a/src/backend/port/dynloader/netbsd.h +++ b/src/backend/port/dynloader/netbsd.h @@ -14,7 +14,6 @@ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H -#include #include #include #include diff --git a/src/backend/port/dynloader/openbsd.h b/src/backend/port/dynloader/openbsd.h index 34d2724615..25d5439633 100644 --- a/src/backend/port/dynloader/openbsd.h +++ b/src/backend/port/dynloader/openbsd.h @@ -13,7 +13,6 @@ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H -#include #include #include #include diff --git a/src/backend/port/win32/crashdump.c b/src/backend/port/win32/crashdump.c index 64969df73d..ff44b6033e 100644 --- a/src/backend/port/win32/crashdump.c +++ b/src/backend/port/win32/crashdump.c @@ -39,8 +39,7 @@ #include "postgres.h" #define WIN32_LEAN_AND_MEAN -#include -#include + /* * Some versions of the MS SDK contain "typedef enum { ... } ;" which the MS * compiler quite sanely complains about. Well done, Microsoft. diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 0c5ffa086c..e8de9a3ced 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -62,7 +62,6 @@ #include "postgres.h" #include -#include #include #include diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 643a17943a..7414048f4e 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -12,7 +12,6 @@ */ #include "postgres.h" -#include #include #include #include diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index c0f28ddc09..6f19cdca8c 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -107,7 +107,6 @@ #include "postgres.h" #include -#include #include #include "miscadmin.h" diff --git a/src/backend/replication/walreceiverfuncs.c b/src/backend/replication/walreceiverfuncs.c index df113b86e8..8bf1fe8565 100644 --- a/src/backend/replication/walreceiverfuncs.c +++ b/src/backend/replication/walreceiverfuncs.c @@ -16,7 +16,6 @@ */ #include "postgres.h" -#include #include #include #include diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c index 07af16622c..54378bcea9 100644 --- a/src/backend/storage/ipc/dsm.c +++ b/src/backend/storage/ipc/dsm.c @@ -27,7 +27,6 @@ #include "postgres.h" #include -#include #include #ifndef WIN32 #include diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index 7078f68c35..b2c9cdc6ed 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -49,7 +49,6 @@ #include "postgres.h" #include -#include #include #ifndef WIN32 #include diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index 0079ba567f..ea7f930866 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -40,7 +40,6 @@ #include #include #include -#include #ifdef HAVE_SYS_EPOLL_H #include #endif diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index ac8f74fee6..5afadb65d1 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "libpq/pqformat.h" #include "utils/builtins.h" diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index ec3a28cd0d..8cdd1dc4f7 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -11,7 +11,6 @@ #include "postgres.h" -#include #include #include "access/heapam.h" diff --git a/src/backend/utils/adt/inet_cidr_ntop.c b/src/backend/utils/adt/inet_cidr_ntop.c index d33534ec17..d5d1289d7d 100644 --- a/src/backend/utils/adt/inet_cidr_ntop.c +++ b/src/backend/utils/adt/inet_cidr_ntop.c @@ -23,7 +23,6 @@ static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.2 2004/03/09 09:17:27 m #include "postgres.h" -#include #include #include #include diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c index b8fa7d2bcc..be788d37cd 100644 --- a/src/backend/utils/adt/inet_net_pton.c +++ b/src/backend/utils/adt/inet_net_pton.c @@ -23,7 +23,6 @@ static const char rcsid[] = "Id: inet_net_pton.c,v 1.4.2.3 2004/03/17 00:40:11 m #include "postgres.h" -#include #include #include #include diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 4c7f1dad50..ab197025f8 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -51,7 +51,6 @@ #include "postgres.h" -#include #include #include "access/htup_details.h" diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index e984e79c60..e0298ee35f 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 540427a892..1ed0d20504 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -52,7 +52,6 @@ #include #include #include -#include #include #include diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 9020fb14d3..bc997dc997 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index e8d0e8984e..15348ada58 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "libpq-fe.h" diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c index 90d93cbed1..1fe42efc21 100644 --- a/src/bin/pg_basebackup/streamutil.c +++ b/src/bin/pg_basebackup/streamutil.c @@ -13,10 +13,7 @@ #include "postgres_fe.h" -#include -#include #include -#include #include /* for ntohl/htonl */ diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 93e5891950..c63819b88b 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -19,16 +19,9 @@ #include "postgres_fe.h" -#include "catalog/pg_control.h" -#include "common/controldata_utils.h" -#include "libpq-fe.h" -#include "pqexpbuffer.h" - #include -#include #include #include -#include #include #include #include @@ -38,8 +31,12 @@ #include #endif +#include "catalog/pg_control.h" +#include "common/controldata_utils.h" #include "getopt_long.h" +#include "libpq-fe.h" #include "miscadmin.h" +#include "pqexpbuffer.h" /* PID can be negative for standalone backend */ typedef long pgpid_t; diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index 775a7f858c..be8e018a96 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -51,6 +51,12 @@ #include "postgres_fe.h" +#ifndef WIN32 +#include +#include +#include +#include +#endif #ifdef HAVE_SYS_SELECT_H #include #endif @@ -59,14 +65,6 @@ #include "pg_backup_utils.h" #include "fe_utils/string_utils.h" -#ifndef WIN32 -#include -#include -#include "signal.h" -#include -#include -#endif - /* Mnemonic macros for indexing the fd array returned by pipe(2) */ #define PIPE_READ 0 #define PIPE_WRITE 1 diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 929f1b592b..7e2bed38b3 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -21,24 +21,22 @@ */ #include "postgres_fe.h" -#include "parallel.h" -#include "pg_backup_archiver.h" -#include "pg_backup_db.h" -#include "pg_backup_utils.h" -#include "dumputils.h" -#include "fe_utils/string_utils.h" - #include #include #include #include -#include #include - #ifdef WIN32 #include #endif +#include "parallel.h" +#include "pg_backup_archiver.h" +#include "pg_backup_db.h" +#include "pg_backup_utils.h" +#include "dumputils.h" +#include "fe_utils/string_utils.h" + #include "libpq/libpq-fs.h" #define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n" diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 89db3103bc..7273ec8fe2 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -33,9 +33,6 @@ #include #include -#ifdef ENABLE_NLS -#include -#endif #ifdef HAVE_TERMIOS_H #include #endif diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 6895d02bfc..f4b4d7bd9b 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -18,10 +18,6 @@ #include #include -#ifdef ENABLE_NLS -#include -#endif - #include "getopt_long.h" #include "dumputils.h" diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index 497677494b..5f61fb2764 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -40,21 +40,16 @@ */ #include "postgres_fe.h" -#include "getopt_long.h" - -#include "dumputils.h" -#include "parallel.h" -#include "pg_backup_utils.h" - #include - #ifdef HAVE_TERMIOS_H #include #endif -#ifdef ENABLE_NLS -#include -#endif +#include "getopt_long.h" + +#include "dumputils.h" +#include "parallel.h" +#include "pg_backup_utils.h" static void usage(const char *progname); diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 502ea5b290..27bd9b04e7 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -39,7 +39,6 @@ #include #include -#include #include #include #include diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c index d48424bfb4..f8d3dfecfa 100644 --- a/src/bin/pg_rewind/copy_fetch.c +++ b/src/bin/pg_rewind/copy_fetch.c @@ -9,12 +9,10 @@ */ #include "postgres_fe.h" -#include #include #include #include #include -#include #include "datapagemap.h" #include "fetch.h" diff --git a/src/bin/pg_rewind/fetch.c b/src/bin/pg_rewind/fetch.c index 08a296d7d4..e9353d8866 100644 --- a/src/bin/pg_rewind/fetch.c +++ b/src/bin/pg_rewind/fetch.c @@ -16,7 +16,6 @@ */ #include "postgres_fe.h" -#include #include #include diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c index f8ca4c925d..4229f0e056 100644 --- a/src/bin/pg_rewind/file_ops.c +++ b/src/bin/pg_rewind/file_ops.c @@ -14,7 +14,6 @@ */ #include "postgres_fe.h" -#include #include #include #include diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c index 151930234c..e5b254069d 100644 --- a/src/bin/pg_rewind/filemap.c +++ b/src/bin/pg_rewind/filemap.c @@ -10,7 +10,6 @@ #include "postgres_fe.h" -#include #include #include diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c index d2374201c6..d86ecd3660 100644 --- a/src/bin/pg_rewind/libpq_fetch.c +++ b/src/bin/pg_rewind/libpq_fetch.c @@ -9,7 +9,6 @@ */ #include "postgres_fe.h" -#include #include #include #include diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index f18be22c16..2e621b027c 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -11,7 +11,6 @@ #include "pg_upgrade.h" -#include #include "fe_utils/string_utils.h" diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c index b6a3ef791e..91fa71728e 100644 --- a/src/bin/pg_upgrade/exec.c +++ b/src/bin/pg_upgrade/exec.c @@ -9,10 +9,9 @@ #include "postgres_fe.h" -#include "pg_upgrade.h" - #include -#include + +#include "pg_upgrade.h" static void check_data_dir(ClusterInfo *cluster); static void check_bin_dir(ClusterInfo *cluster); diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c index 82d2443bcd..5007ce53cf 100644 --- a/src/bin/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -9,17 +9,16 @@ #include "postgres_fe.h" -#include "miscadmin.h" -#include "getopt_long.h" - -#include "pg_upgrade.h" - #include -#include #ifdef WIN32 #include #endif +#include "miscadmin.h" +#include "getopt_long.h" + +#include "pg_upgrade.h" + static void usage(void); static void check_required_directory(char **dirpath, char **configpath, diff --git a/src/bin/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c index d35015f52a..7c85a13a99 100644 --- a/src/bin/pg_upgrade/parallel.c +++ b/src/bin/pg_upgrade/parallel.c @@ -9,17 +9,14 @@ #include "postgres_fe.h" -#include "pg_upgrade.h" - -#include -#include -#include #include - #ifdef WIN32 #include #endif +#include "pg_upgrade.h" + + static int parallel_jobs; #ifdef WIN32 diff --git a/src/bin/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c index 24f7bd960c..4938bc2de2 100644 --- a/src/bin/pg_upgrade/tablespace.c +++ b/src/bin/pg_upgrade/tablespace.c @@ -11,8 +11,6 @@ #include "pg_upgrade.h" -#include - static void get_tablespace_paths(void); static void set_tablespace_directory_suffix(ClusterInfo *cluster); diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c index 5332a13256..f68f987c17 100644 --- a/src/bin/pgevent/pgevent.c +++ b/src/bin/pgevent/pgevent.c @@ -10,15 +10,9 @@ * *------------------------------------------------------------------------- */ - - #include "postgres_fe.h" -#include #include -#include -#include -#include /* Global variables */ HANDLE g_module = NULL; /* hModule of DLL */ diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f17f610717..a28f5134b9 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -18,7 +18,6 @@ #include #endif #ifndef WIN32 -#include /* for umask() */ #include /* for stat() */ #include /* open() flags */ #include /* for geteuid(), getpid(), stat() */ @@ -27,7 +26,6 @@ #include #include #include -#include /* for umask() */ #include /* for stat() */ #endif diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c index bf48d2f406..2794eb6b87 100644 --- a/src/bin/psql/crosstabview.c +++ b/src/bin/psql/crosstabview.c @@ -7,8 +7,6 @@ */ #include "postgres_fe.h" -#include - #include "common.h" #include "crosstabview.h" #include "pqexpbuffer.h" diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 3e3cab4941..91cf0be46a 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -8,7 +8,6 @@ #include "postgres_fe.h" #ifndef WIN32 -#include /* (ditto) */ #include /* for geteuid() */ #else #include diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 88d686a5b7..694f0ef257 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -7,8 +7,6 @@ */ #include "postgres_fe.h" -#include - #ifndef WIN32 #include #else /* WIN32 */ @@ -18,8 +16,6 @@ #include "getopt_long.h" -#include - #include "command.h" #include "common.h" #include "describe.h" diff --git a/src/common/ip.c b/src/common/ip.c index d981dbcac9..80711dbb98 100644 --- a/src/common/ip.c +++ b/src/common/ip.c @@ -24,7 +24,6 @@ #endif #include -#include #include #include #include diff --git a/src/common/username.c b/src/common/username.c index d6abac8281..487eacfe73 100644 --- a/src/common/username.c +++ b/src/common/username.c @@ -18,10 +18,8 @@ #include "postgres_fe.h" #endif -#include #include #include -#include #include "common/username.h" diff --git a/src/common/wait_error.c b/src/common/wait_error.c index 7ac545c67a..f824a5f2af 100644 --- a/src/common/wait_error.c +++ b/src/common/wait_error.c @@ -21,8 +21,6 @@ #endif #include -#include -#include #include /* diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index 5ca27a93e0..9180b90004 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -18,7 +18,6 @@ #include "postgres_fe.h" #include -#include #include #include #include diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index 538066e106..d4885a5e28 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -14,7 +14,6 @@ #ifndef LIBPQ_H #define LIBPQ_H -#include #include #include "lib/stringinfo.h" diff --git a/src/include/port/atomics/generic-msvc.h b/src/include/port/atomics/generic-msvc.h index c7caf04d57..d5ee6e1bcb 100644 --- a/src/include/port/atomics/generic-msvc.h +++ b/src/include/port/atomics/generic-msvc.h @@ -17,7 +17,6 @@ *------------------------------------------------------------------------- */ #include -#include /* intentionally no include guards, should only be included by atomics.h */ #ifndef INSIDE_ATOMICS_H diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index be91f9b88c..cb509e2b6b 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -12,7 +12,6 @@ #ifndef _PG_LOCALE_ #define _PG_LOCALE_ -#include #if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE) #include #endif diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 23646a9579..499a4c1780 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -3,8 +3,6 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" -#include -#include #include #include diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index d5a463d940..bd9b86be49 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -16,7 +16,6 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" -#include #include #include diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c index db65ec10f1..f90279cf81 100644 --- a/src/interfaces/ecpg/ecpglib/typename.c +++ b/src/interfaces/ecpg/ecpglib/typename.c @@ -3,7 +3,6 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" -#include #include "ecpgtype.h" #include "ecpglib.h" #include "extern.h" diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index fa80bb289e..aaecbf8122 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -6,7 +6,7 @@ #include "postgres_fe.h" #include -#include + #include "getopt_long.h" #include "extern.h" diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index b894a33e53..6b58dd5afe 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -19,7 +19,6 @@ #include "postgres_fe.h" #include -#include #include #include "extern.h" diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 65b7c31dc0..685f355ab3 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -15,7 +15,6 @@ #include "postgres_fe.h" -#include #include #include #include diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index e9b73a925e..24242da221 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -25,7 +25,6 @@ #include "libpq-events.h" #include -#include #ifndef WIN32 #include #endif diff --git a/src/interfaces/libpq/pthread-win32.c b/src/interfaces/libpq/pthread-win32.c index e63432d822..0e0d3eeb88 100644 --- a/src/interfaces/libpq/pthread-win32.c +++ b/src/interfaces/libpq/pthread-win32.c @@ -12,7 +12,6 @@ #include "postgres_fe.h" -#include #include "pthread-win32.h" DWORD diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index fc10d30f45..00979cba74 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -13,7 +13,6 @@ #include #include #include -#include #include /* postgreSQL stuff */ diff --git a/src/port/chklocale.c b/src/port/chklocale.c index 54ce9410f0..c6ec929702 100644 --- a/src/port/chklocale.c +++ b/src/port/chklocale.c @@ -19,11 +19,6 @@ #include "postgres_fe.h" #endif -#if defined(WIN32) && (_MSC_VER >= 1900) -#include -#endif - -#include #ifdef HAVE_LANGINFO_H #include #endif diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 08835962be..84039ff38a 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -34,7 +34,6 @@ #ifndef __CYGWIN__ #include #else -#include #include #endif #endif diff --git a/src/port/inet_net_ntop.c b/src/port/inet_net_ntop.c index 047895e4f4..cebcda0e61 100644 --- a/src/port/inet_net_ntop.c +++ b/src/port/inet_net_ntop.c @@ -27,7 +27,6 @@ static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.2 2004/03/09 09:17:27 m #include "postgres_fe.h" #endif -#include #include #include #include diff --git a/src/port/open.c b/src/port/open.c index db7abdbe03..aa31342261 100644 --- a/src/port/open.c +++ b/src/port/open.c @@ -19,7 +19,6 @@ #include "postgres_fe.h" #endif -#include #include #include diff --git a/src/port/system.c b/src/port/system.c index 8651187890..3d99c7985f 100644 --- a/src/port/system.c +++ b/src/port/system.c @@ -44,7 +44,6 @@ #include "postgres_fe.h" #endif -#include #include #undef system diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index db2b55982b..f77f465751 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -7,9 +7,6 @@ #include "postgres_fe.h" -#ifdef WIN32 -#include -#endif #include #ifdef HAVE_SYS_SELECT_H #include diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c index 4a0a01db65..acaba86881 100644 --- a/src/timezone/strftime.c +++ b/src/timezone/strftime.c @@ -41,7 +41,6 @@ #include "postgres.h" #include -#include #include "private.h" #include "tzfile.h" diff --git a/src/timezone/zic.c b/src/timezone/zic.c index a83cea12dd..e1875585df 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -9,7 +9,6 @@ #include "postgres_fe.h" #include -#include #include #include #include -- 2.40.0