I noticed that some header files included system header files for no apparent reason, so I did some digging and found out that in a few cases the original reason has disappeared. So I propose the attached patches to remove the unnecessary includes.
From 535c69e62f1ed3db27ea6d39d304ebfcf0f12a29 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 1 Dec 2023 08:32:11 +0100
Subject: [PATCH 1/3] Remove unnecessary includes of <signal.h>

These were once needed for sig_atomic_t, but that no longer appears in
these headers, so the include is not needed.
---
 src/include/replication/walsender.h       | 2 --
 src/include/replication/worker_internal.h | 2 --
 2 files changed, 4 deletions(-)

diff --git a/src/include/replication/walsender.h 
b/src/include/replication/walsender.h
index 268f8e8d0f..60313980a9 100644
--- a/src/include/replication/walsender.h
+++ b/src/include/replication/walsender.h
@@ -12,8 +12,6 @@
 #ifndef _WALSENDER_H
 #define _WALSENDER_H
 
-#include <signal.h>
-
 /*
  * What to do with a snapshot in create replication slot command.
  */
diff --git a/src/include/replication/worker_internal.h 
b/src/include/replication/worker_internal.h
index 47854b5cd4..db73408937 100644
--- a/src/include/replication/worker_internal.h
+++ b/src/include/replication/worker_internal.h
@@ -12,8 +12,6 @@
 #ifndef WORKER_INTERNAL_H
 #define WORKER_INTERNAL_H
 
-#include <signal.h>
-
 #include "access/xlogdefs.h"
 #include "catalog/pg_subscription.h"
 #include "datatype/timestamp.h"
-- 
2.43.0

From b738db5a571fce7cf6b20ab8760f31d6c69b0002 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 1 Dec 2023 08:32:11 +0100
Subject: [PATCH 2/3] Remove unnecessary include of <sys/socket.h>

This was put here as part of a mechanical replacement of the old
"getaddrinfo.h" with <netdb.h> plus <sys/socket.h> (commit
5579388d2d).  But here, we only need netdb.h (for NI_MAXHOST), not
sys/socket.h.
---
 src/include/replication/walreceiver.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/include/replication/walreceiver.h 
b/src/include/replication/walreceiver.h
index 04b439dc50..949e874f21 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -13,7 +13,6 @@
 #define _WALRECEIVER_H
 
 #include <netdb.h>
-#include <sys/socket.h>
 
 #include "access/xlog.h"
 #include "access/xlogdefs.h"
-- 
2.43.0

From e805f390a1ebafeeed3cb0e38f4cebba80a85c41 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 1 Dec 2023 08:32:11 +0100
Subject: [PATCH 3/3] Remove unnecessary include of <math.h>

This was probably never necessary.  (The header used to use random(),
but that shouldn't require <math.h> either.  In any case, that's gone,
too.)
---
 src/include/optimizer/geqo_random.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/include/optimizer/geqo_random.h 
b/src/include/optimizer/geqo_random.h
index 08b0c08d85..e3e12e900d 100644
--- a/src/include/optimizer/geqo_random.h
+++ b/src/include/optimizer/geqo_random.h
@@ -24,8 +24,6 @@
 #ifndef GEQO_RANDOM_H
 #define GEQO_RANDOM_H
 
-#include <math.h>
-
 #include "optimizer/geqo.h"
 
 
-- 
2.43.0

Reply via email to