summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane2017-02-25 21:12:24 +0000
committerTom Lane2017-02-25 21:12:55 +0000
commit9e3755ecb2d058f7d123dd35a2e1784006190962 (patch)
treef938cae7833ef756947d4ac074a83d31f5f6113d /src
parent5639ceddcb7f3efa8751b2ba6e50cc1d27cc2a45 (diff)
Remove useless duplicate inclusions of system header files.
c.h #includes a number of core libc header files, such as <stdio.h>. 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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/timeline.c1
-rw-r--r--src/backend/access/transam/twophase.c1
-rw-r--r--src/backend/access/transam/xlogarchive.c1
-rw-r--r--src/backend/commands/dbcommands.c1
-rw-r--r--src/backend/commands/tablespace.c1
-rw-r--r--src/backend/libpq/ifaddr.c1
-rw-r--r--src/backend/port/atomics.c1
-rw-r--r--src/backend/port/dynloader/freebsd.h1
-rw-r--r--src/backend/port/dynloader/netbsd.h1
-rw-r--r--src/backend/port/dynloader/openbsd.h1
-rw-r--r--src/backend/port/win32/crashdump.c3
-rw-r--r--src/backend/postmaster/autovacuum.c1
-rw-r--r--src/backend/replication/basebackup.c1
-rw-r--r--src/backend/replication/logical/snapbuild.c1
-rw-r--r--src/backend/replication/walreceiverfuncs.c1
-rw-r--r--src/backend/storage/ipc/dsm.c1
-rw-r--r--src/backend/storage/ipc/dsm_impl.c1
-rw-r--r--src/backend/storage/ipc/latch.c1
-rw-r--r--src/backend/utils/adt/cash.c1
-rw-r--r--src/backend/utils/adt/dbsize.c1
-rw-r--r--src/backend/utils/adt/inet_cidr_ntop.c1
-rw-r--r--src/backend/utils/adt/inet_net_pton.c1
-rw-r--r--src/backend/utils/adt/pg_locale.c1
-rw-r--r--src/backend/utils/init/miscinit.c1
-rw-r--r--src/bin/initdb/initdb.c1
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c1
-rw-r--r--src/bin/pg_basebackup/pg_receivewal.c1
-rw-r--r--src/bin/pg_basebackup/streamutil.c3
-rw-r--r--src/bin/pg_ctl/pg_ctl.c11
-rw-r--r--src/bin/pg_dump/parallel.c14
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c16
-rw-r--r--src/bin/pg_dump/pg_dump.c3
-rw-r--r--src/bin/pg_dump/pg_dumpall.c4
-rw-r--r--src/bin/pg_dump/pg_restore.c15
-rw-r--r--src/bin/pg_resetwal/pg_resetwal.c1
-rw-r--r--src/bin/pg_rewind/copy_fetch.c2
-rw-r--r--src/bin/pg_rewind/fetch.c1
-rw-r--r--src/bin/pg_rewind/file_ops.c1
-rw-r--r--src/bin/pg_rewind/filemap.c1
-rw-r--r--src/bin/pg_rewind/libpq_fetch.c1
-rw-r--r--src/bin/pg_upgrade/dump.c1
-rw-r--r--src/bin/pg_upgrade/exec.c5
-rw-r--r--src/bin/pg_upgrade/option.c11
-rw-r--r--src/bin/pg_upgrade/parallel.c9
-rw-r--r--src/bin/pg_upgrade/tablespace.c2
-rw-r--r--src/bin/pgevent/pgevent.c6
-rw-r--r--src/bin/psql/command.c2
-rw-r--r--src/bin/psql/crosstabview.c2
-rw-r--r--src/bin/psql/help.c1
-rw-r--r--src/bin/psql/startup.c4
-rw-r--r--src/common/ip.c1
-rw-r--r--src/common/username.c2
-rw-r--r--src/common/wait_error.c2
-rw-r--r--src/fe_utils/print.c1
-rw-r--r--src/include/libpq/libpq.h1
-rw-r--r--src/include/port/atomics/generic-msvc.h1
-rw-r--r--src/include/utils/pg_locale.h1
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c2
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c1
-rw-r--r--src/interfaces/ecpg/ecpglib/typename.c1
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c2
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l1
-rw-r--r--src/interfaces/libpq/fe-connect.c1
-rw-r--r--src/interfaces/libpq/libpq-int.h1
-rw-r--r--src/interfaces/libpq/pthread-win32.c1
-rw-r--r--src/pl/plperl/plperl.c1
-rw-r--r--src/port/chklocale.c5
-rw-r--r--src/port/dirmod.c1
-rw-r--r--src/port/inet_net_ntop.c1
-rw-r--r--src/port/open.c1
-rw-r--r--src/port/system.c1
-rw-r--r--src/test/isolation/isolationtester.c3
-rw-r--r--src/timezone/strftime.c1
-rw-r--r--src/timezone/zic.c1
74 files changed, 34 insertions, 145 deletions
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index c8240b112df..1fdc59190c4 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -32,7 +32,6 @@
#include "postgres.h"
#include <sys/stat.h>
-#include <stdio.h>
#include <unistd.h>
#include "access/timeline.h"
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 50c70b29204..0a8edb9e580 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -54,7 +54,6 @@
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <time.h>
#include <unistd.h>
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index 7e91e8f81ad..7afb73579b0 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -14,7 +14,6 @@
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 1ebacbc24fe..5a63b1abcbe 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -20,7 +20,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include <unistd.h>
#include <sys/stat.h>
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 80515bae19c..f9c26201d98 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -48,7 +48,6 @@
#include <unistd.h>
#include <dirent.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include "access/heapam.h"
diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c
index 7692881c8ba..f81003f7c89 100644
--- a/src/backend/libpq/ifaddr.c
+++ b/src/backend/libpq/ifaddr.c
@@ -20,7 +20,6 @@
#include "postgres.h"
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c
index 86b53082142..756a2ef997a 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 <sys/types.h>
#include <signal.h>
#endif
diff --git a/src/backend/port/dynloader/freebsd.h b/src/backend/port/dynloader/freebsd.h
index 78dda699229..6116d3f83f5 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 <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/dynloader/netbsd.h b/src/backend/port/dynloader/netbsd.h
index 688b7fb7930..0bd406850da 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 <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/dynloader/openbsd.h b/src/backend/port/dynloader/openbsd.h
index 34d27246155..25d5439633a 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 <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
diff --git a/src/backend/port/win32/crashdump.c b/src/backend/port/win32/crashdump.c
index 64969df73df..ff44b6033ed 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 <windows.h>
-#include <string.h>
+
/*
* 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 0c5ffa086c3..e8de9a3ced4 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -62,7 +62,6 @@
#include "postgres.h"
#include <signal.h>
-#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 643a17943af..7414048f4eb 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -12,7 +12,6 @@
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index c0f28ddc090..6f19cdca8cc 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -107,7 +107,6 @@
#include "postgres.h"
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "miscadmin.h"
diff --git a/src/backend/replication/walreceiverfuncs.c b/src/backend/replication/walreceiverfuncs.c
index df113b86e85..8bf1fe85652 100644
--- a/src/backend/replication/walreceiverfuncs.c
+++ b/src/backend/replication/walreceiverfuncs.c
@@ -16,7 +16,6 @@
*/
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c
index 07af16622ce..54378bcea98 100644
--- a/src/backend/storage/ipc/dsm.c
+++ b/src/backend/storage/ipc/dsm.c
@@ -27,7 +27,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c
index 7078f68c356..b2c9cdc6edd 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 <fcntl.h>
-#include <string.h>
#include <unistd.h>
#ifndef WIN32
#include <sys/mman.h>
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index 0079ba567f6..ea7f930866f 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -40,7 +40,6 @@
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
-#include <sys/types.h>
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
#endif
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index ac8f74fee63..5afadb65d11 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -21,7 +21,6 @@
#include <limits.h>
#include <ctype.h>
#include <math.h>
-#include <locale.h>
#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 ec3a28cd0d0..8cdd1dc4f79 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -11,7 +11,6 @@
#include "postgres.h"
-#include <sys/types.h>
#include <sys/stat.h>
#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 d33534ec173..d5d1289d7d9 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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c
index b8fa7d2bccf..be788d37cd0 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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 4c7f1dad50e..ab197025f81 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 <locale.h>
#include <time.h>
#include "access/htup_details.h"
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index e984e79c602..e0298ee35ff 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -20,7 +20,6 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <grp.h>
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 540427a8922..1ed0d205041 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -52,7 +52,6 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 9020fb14d39..bc997dc9973 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -16,7 +16,6 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <time.h>
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index e8d0e8984e6..15348ada58d 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -17,7 +17,6 @@
#include <dirent.h>
#include <signal.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "libpq-fe.h"
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index 90d93cbed16..1fe42efc215 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -13,10 +13,7 @@
#include "postgres_fe.h"
-#include <stdio.h>
-#include <string.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <unistd.h>
/* for ntohl/htonl */
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 93e58919503..c63819b88b4 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 <fcntl.h>
-#include <locale.h>
#include <signal.h>
#include <time.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -38,8 +31,12 @@
#include <sys/resource.h>
#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 775a7f858c9..be8e018a964 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 <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
@@ -59,14 +65,6 @@
#include "pg_backup_utils.h"
#include "fe_utils/string_utils.h"
-#ifndef WIN32
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "signal.h"
-#include <unistd.h>
-#include <fcntl.h>
-#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 929f1b592bc..7e2bed38b3b 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 <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#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 89db3103bc7..7273ec8fe2a 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -33,9 +33,6 @@
#include <unistd.h>
#include <ctype.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 6895d02bfc8..f4b4d7bd9b6 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -18,10 +18,6 @@
#include <time.h>
#include <unistd.h>
-#ifdef ENABLE_NLS
-#include <locale.h>
-#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 497677494bc..5f61fb2764e 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 <ctype.h>
-
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
-#ifdef ENABLE_NLS
-#include <locale.h>
-#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 502ea5b2900..27bd9b04e7c 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -39,7 +39,6 @@
#include <dirent.h>
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index d48424bfb4a..f8d3dfecfa1 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 <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
-#include <string.h>
#include "datapagemap.h"
#include "fetch.h"
diff --git a/src/bin/pg_rewind/fetch.c b/src/bin/pg_rewind/fetch.c
index 08a296d7d4f..e9353d88661 100644
--- a/src/bin/pg_rewind/fetch.c
+++ b/src/bin/pg_rewind/fetch.c
@@ -16,7 +16,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index f8ca4c925d2..4229f0e056c 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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 151930234c1..e5b254069d4 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -10,7 +10,6 @@
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index d2374201c66..d86ecd36605 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 <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c
index f18be22c160..2e621b027c8 100644
--- a/src/bin/pg_upgrade/dump.c
+++ b/src/bin/pg_upgrade/dump.c
@@ -11,7 +11,6 @@
#include "pg_upgrade.h"
-#include <sys/types.h>
#include "fe_utils/string_utils.h"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index b6a3ef791ef..91fa71728e8 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 <fcntl.h>
-#include <sys/types.h>
+
+#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 82d2443bcd4..5007ce53cf2 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 <time.h>
-#include <sys/types.h>
#ifdef WIN32
#include <io.h>
#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 d35015f52ac..7c85a13a992 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 <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
#include <sys/wait.h>
-
#ifdef WIN32
#include <io.h>
#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 24f7bd960c0..4938bc2de26 100644
--- a/src/bin/pg_upgrade/tablespace.c
+++ b/src/bin/pg_upgrade/tablespace.c
@@ -11,8 +11,6 @@
#include "pg_upgrade.h"
-#include <sys/types.h>
-
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 5332a13256d..f68f987c174 100644
--- a/src/bin/pgevent/pgevent.c
+++ b/src/bin/pgevent/pgevent.c
@@ -10,15 +10,9 @@
*
*-------------------------------------------------------------------------
*/
-
-
#include "postgres_fe.h"
-#include <windows.h>
#include <olectl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
/* Global variables */
HANDLE g_module = NULL; /* hModule of DLL */
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index f17f6107175..a28f5134b92 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -18,7 +18,6 @@
#include <pwd.h>
#endif
#ifndef WIN32
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#include <fcntl.h> /* open() flags */
#include <unistd.h> /* for geteuid(), getpid(), stat() */
@@ -27,7 +26,6 @@
#include <io.h>
#include <fcntl.h>
#include <direct.h>
-#include <sys/types.h> /* for umask() */
#include <sys/stat.h> /* for stat() */
#endif
diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c
index bf48d2f4062..2794eb6b876 100644
--- a/src/bin/psql/crosstabview.c
+++ b/src/bin/psql/crosstabview.c
@@ -7,8 +7,6 @@
*/
#include "postgres_fe.h"
-#include <string.h>
-
#include "common.h"
#include "crosstabview.h"
#include "pqexpbuffer.h"
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 3e3cab49418..91cf0be46a6 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -8,7 +8,6 @@
#include "postgres_fe.h"
#ifndef WIN32
-#include <sys/types.h> /* (ditto) */
#include <unistd.h> /* for geteuid() */
#else
#include <win32.h>
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 88d686a5b74..694f0ef257f 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -7,8 +7,6 @@
*/
#include "postgres_fe.h"
-#include <sys/types.h>
-
#ifndef WIN32
#include <unistd.h>
#else /* WIN32 */
@@ -18,8 +16,6 @@
#include "getopt_long.h"
-#include <locale.h>
-
#include "command.h"
#include "common.h"
#include "describe.h"
diff --git a/src/common/ip.c b/src/common/ip.c
index d981dbcac95..80711dbb989 100644
--- a/src/common/ip.c
+++ b/src/common/ip.c
@@ -24,7 +24,6 @@
#endif
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
diff --git a/src/common/username.c b/src/common/username.c
index d6abac82813..487eacfe73f 100644
--- a/src/common/username.c
+++ b/src/common/username.c
@@ -18,10 +18,8 @@
#include "postgres_fe.h"
#endif
-#include <errno.h>
#include <pwd.h>
#include <unistd.h>
-#include <sys/types.h>
#include "common/username.h"
diff --git a/src/common/wait_error.c b/src/common/wait_error.c
index 7ac545c67ac..f824a5f2af3 100644
--- a/src/common/wait_error.c
+++ b/src/common/wait_error.c
@@ -21,8 +21,6 @@
#endif
#include <signal.h>
-#include <stdio.h>
-#include <string.h>
#include <sys/wait.h>
/*
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
index 5ca27a93e09..9180b900048 100644
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -18,7 +18,6 @@
#include "postgres_fe.h"
#include <limits.h>
-#include <locale.h>
#include <math.h>
#include <signal.h>
#include <unistd.h>
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index 538066e1067..d4885a5e282 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -14,7 +14,6 @@
#ifndef LIBPQ_H
#define LIBPQ_H
-#include <sys/types.h>
#include <netinet/in.h>
#include "lib/stringinfo.h"
diff --git a/src/include/port/atomics/generic-msvc.h b/src/include/port/atomics/generic-msvc.h
index c7caf04d57e..d5ee6e1bcbe 100644
--- a/src/include/port/atomics/generic-msvc.h
+++ b/src/include/port/atomics/generic-msvc.h
@@ -17,7 +17,6 @@
*-------------------------------------------------------------------------
*/
#include <intrin.h>
-#include <windows.h>
/* 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 be91f9b88c7..cb509e2b6b0 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 <locale.h>
#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
#include <xlocale.h>
#endif
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 23646a95791..499a4c17804 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 <stdlib.h>
-#include <string.h>
#include <float.h>
#include <math.h>
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index d5a463d9404..bd9b86be496 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 <locale.h>
#include <float.h>
#include <math.h>
diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c
index db65ec10f18..f90279cf81a 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 <stdlib.h>
#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 fa80bb289e5..aaecbf8122c 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -6,7 +6,7 @@
#include "postgres_fe.h"
#include <unistd.h>
-#include <string.h>
+
#include "getopt_long.h"
#include "extern.h"
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index b894a33e53f..6b58dd5afe7 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -19,7 +19,6 @@
#include "postgres_fe.h"
#include <ctype.h>
-#include <sys/types.h>
#include <limits.h>
#include "extern.h"
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 65b7c31dc03..685f355ab36 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -15,7 +15,6 @@
#include "postgres_fe.h"
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index e9b73a925ed..24242da221e 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -25,7 +25,6 @@
#include "libpq-events.h"
#include <time.h>
-#include <sys/types.h>
#ifndef WIN32
#include <sys/time.h>
#endif
diff --git a/src/interfaces/libpq/pthread-win32.c b/src/interfaces/libpq/pthread-win32.c
index e63432d8222..0e0d3eeb88d 100644
--- a/src/interfaces/libpq/pthread-win32.c
+++ b/src/interfaces/libpq/pthread-win32.c
@@ -12,7 +12,6 @@
#include "postgres_fe.h"
-#include <windows.h>
#include "pthread-win32.h"
DWORD
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index fc10d30f45b..00979cba743 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -13,7 +13,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
-#include <locale.h>
#include <unistd.h>
/* postgreSQL stuff */
diff --git a/src/port/chklocale.c b/src/port/chklocale.c
index 54ce9410f03..c6ec929702f 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 <windows.h>
-#endif
-
-#include <locale.h>
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 08835962be6..84039ff38a2 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -34,7 +34,6 @@
#ifndef __CYGWIN__
#include <winioctl.h>
#else
-#include <windows.h>
#include <w32api/winioctl.h>
#endif
#endif
diff --git a/src/port/inet_net_ntop.c b/src/port/inet_net_ntop.c
index 047895e4f4f..cebcda0e615 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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/port/open.c b/src/port/open.c
index db7abdbe036..aa313422610 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -19,7 +19,6 @@
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#include <assert.h>
diff --git a/src/port/system.c b/src/port/system.c
index 8651187890f..3d99c7985f2 100644
--- a/src/port/system.c
+++ b/src/port/system.c
@@ -44,7 +44,6 @@
#include "postgres_fe.h"
#endif
-#include <windows.h>
#include <fcntl.h>
#undef system
diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c
index db2b55982b6..f77f4657512 100644
--- a/src/test/isolation/isolationtester.c
+++ b/src/test/isolation/isolationtester.c
@@ -7,9 +7,6 @@
#include "postgres_fe.h"
-#ifdef WIN32
-#include <windows.h>
-#endif
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 4a0a01db651..acaba86881d 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -41,7 +41,6 @@
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include "private.h"
#include "tzfile.h"
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index a83cea12ddc..e1875585df4 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -9,7 +9,6 @@
#include "postgres_fe.h"
#include <fcntl.h>
-#include <locale.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>